Coverity: boolean module resource leaks fixed 93/18193/4
Dhruv Khattar [Sat, 28 May 2016 11:29:00 +0000 (16:29 +0530)]
Change-Id: I957ba6620e3f1624f8ec95038cfc4ed8707c494a

scilab/modules/boolean/sci_gateway/cpp/sci_and.cpp
scilab/modules/boolean/sci_gateway/cpp/sci_bool2s.cpp
scilab/modules/boolean/sci_gateway/cpp/sci_or.cpp

index f72cabf..6378f24 100644 (file)
@@ -29,6 +29,7 @@ extern "C"
 #include "Scierror.h"
 #include "localization.h"
 #include "vect_and.h"
+#include "sci_malloc.h"
 }
 /*--------------------------------------------------------------------------*/
 /* SCILAB function : and */
@@ -99,11 +100,12 @@ types::Function::ReturnValue sci_and(types::typed_list &in, int _iRetCount, type
                 default:
                 {
                     Scierror(999, _("%s: Wrong value for input argument #%d.\n"), "and", 2);
+                    FREE(pStr);
                     return types::Function::Error;
                 }
             }
 
-            delete pStr;
+            FREE(pStr);
             if (len != 1)
             {
                 Scierror(999, _("%s: Wrong value for input argument #%d.\n"), "and", 2);
index fdd106b..dc78b12 100644 (file)
@@ -102,6 +102,9 @@ types::Function::ReturnValue sci_bool2s(types::typed_list &in, int _iRetCount, t
         }
 
         pOut = pSpOut;
+        delete[] pNonZeroR;
+        delete[] pNonZeroI;
+        delete[] pRows;
     }
     else if (in[0]->isSparseBool())
     {
index ae7d481..d4e7b27 100644 (file)
@@ -29,6 +29,7 @@ extern "C"
 #include "Scierror.h"
 #include "localization.h"
 #include "vect_or.h"
+#include "sci_malloc.h"
 }
 /*--------------------------------------------------------------------------*/
 /* SCILAB function : or */
@@ -95,11 +96,12 @@ types::Function::ReturnValue sci_or(types::typed_list &in, int _iRetCount, types
                 default:
                 {
                     Scierror(44, _("%s: Wrong value for input argument #%d.\n"), "or", 2);
+                    FREE(pStr);
                     return types::Function::Error;
                 }
                 break;
             }
-            delete(pStr);
+            FREE(pStr);
             if (len != 1)
             {
                 Scierror(44, _("%s: Wrong value for input argument #%d.\n"), "or", 2);