fixed memory leaks associated with 1) not freeing line variable and 2) deallocation of c/fortran varaibles