Free already allocated memory on exit in lmmin

Otherwise we would leak memory in case any of the later malloc() calls
fails. Since free() explicitely allows for a NULL pointer to be passed,
initialize all pointer to NULL before allocation, so stray pointer is
accidentially passed to free().