differential_equations: fix dasrt/dassl memleaks
[scilab.git] / scilab / modules / differential_equations / sci_gateway / cpp / sci_dasrt.cpp
index f5123c8..f0ce3c5 100644 (file)
@@ -767,6 +767,10 @@ types::Function::ReturnValue sci_dasrt(types::typed_list &in, int _iRetCount, ty
 
         if (iret == 1)
         {
+            for (types::InternalType* pIT : lpDblOut)
+            {
+                pIT->killMe();
+            }
             lpDblOut.clear();
             DifferentialEquation::removeDifferentialEquationFunctions();
             FREE(pdYdotData);
@@ -833,6 +837,7 @@ types::Function::ReturnValue sci_dasrt(types::typed_list &in, int _iRetCount, ty
     {
         int pos = i * rowsOut;
         C2F(dcopy)(&rowsOut, lpDblOut.front()->get(), &one, pDblOut->get() + pos, &one);
+        lpDblOut.front()->killMe();
         lpDblOut.pop_front();
     }
     out.push_back(pDblOut);