Index: /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/shared/Alloc/alloc_module.cpp =================================================================== --- /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/shared/Alloc/alloc_module.cpp (revision 12851) +++ /u/astrid-r1b/morlighe/issmuci/trunk-jpl/../trunk-jpl/src/c/shared/Alloc/alloc_module.cpp (revision 12852) @@ -21,11 +21,9 @@ if (pv && *pv){ /*Actually, still get rid of internal Petsc matrix. Quick fix until Matlab handles C++ * correctly: */ - /*Keeping this for legacy reasons: */ - /*#ifdef _HAVE_PETSC_ - MatFree(&(*pv)->matrix); - #endif*/ - delete *pv; + #ifdef _HAVE_PETSC_ + MatFree(&(*pv)->pmatrix->matrix); + #endif *pv=NULL; } } @@ -35,11 +33,9 @@ if (pv && *pv){ /*Actually, still get rid of internal Petsc vector. Quick fix until Matlab handles C++ * correctly: */ - /*Keeping this for legacy reasons: shoudl be done by the vector itself!*/ - /*#ifdef _HAVE_PETSC_ - VecFree(&(*pv)->vector); - #endif*/ - delete *pv; + #ifdef _HAVE_PETSC_ + VecFree(&(*pv)->pvector->vector); + #endif *pv=NULL; } }