Index: ../trunk-jpl/src/c/cores/controlvalidation_core.cpp =================================================================== --- ../trunk-jpl/src/c/cores/controlvalidation_core.cpp (revision 18572) +++ ../trunk-jpl/src/c/cores/controlvalidation_core.cpp (revision 18573) @@ -35,8 +35,7 @@ X0 = Xpetsc->ToMPISerial(); delete Xpetsc; - /*Allocate Gradient and current vector*/ - G = xNew(n); + /*Allocate current vector*/ X = xNew(n); /*out of solution_type, figure out solution core and adjoint function pointer*/ @@ -109,6 +108,7 @@ femmodel->OutputControlsx(&femmodel->results); /*Clean up and return*/ + xDelete(output); xDelete(G); xDelete(X); xDelete(X0); Index: ../trunk-jpl/src/c/classes/FemModel.cpp =================================================================== --- ../trunk-jpl/src/c/classes/FemModel.cpp (revision 18572) +++ ../trunk-jpl/src/c/classes/FemModel.cpp (revision 18573) @@ -1484,7 +1484,8 @@ /*Compute SurfaceAbsMisfitEnum*/ J+=0.5*(surface-surfaceobs)*(surface-surfaceobs)*weight*Jdet*gauss->weight; } - + delete gauss; + xDelete(xyz_list); } /*Sum all J from all cpus of the cluster:*/