Fix memory leaks found by coverity (CID 1098781 & 1098880) 37/12737/2
Sylvestre Ledru [Sun, 29 Sep 2013 10:36:14 +0000 (12:36 +0200)]
Change-Id: Ie153ddb38c26e3dabe5df6164e66e73595945a0e

scilab/modules/external_objects_java/sci_gateway/cpp/sci_jconvMatrixMethod.cpp
scilab/modules/external_objects_java/src/cpp/ScilabJavaEnvironment.cpp

index 50937fe..db72e08 100644 (file)
@@ -76,10 +76,13 @@ int sci_jconvMatrixMethod(char * fname, unsigned long fname_len)
     }
     else
     {
+        delete type;
         Scierror(999, "%s: Invalid string: \"rc\" or \"cr\" expected.", fname);
         return 0;
     }
 
+    delete type;
+
     LhsVar(1) = 0;
     PutLhsVar();
 
index 806fb43..fea094e 100644 (file)
@@ -396,7 +396,9 @@ std::vector<std::string> ScilabJavaEnvironment::getCompletion(int id, char ** fi
     for (int i = 0; i < len; i++)
     {
         v.push_back(fields[i]);
+        delete fields[i];
     }
+    delete fields;
 
     return v;
 }