Coverity: Signal_Processing module Resource Leaks fixed 40/18140/2
Dhruv Khattar [Fri, 6 May 2016 04:37:18 +0000 (09:37 +0530)]
Change-Id: Ic951186ac85535219d45c8d8a515de294daa8092

scilab/modules/signal_processing/sci_gateway/c/sci_remez.c
scilab/modules/signal_processing/sci_gateway/cpp/sci_corr.cpp

index 66148a7..8776a5b 100644 (file)
@@ -104,6 +104,13 @@ int remez_buffered(int ngrid, int nc, int *iext, float *des, float *grid, float
     buffer6 = (double *)MALLOC((nc + 2) * sizeof(double));
     if (buffer0 == NULL || buffer1 == NULL || buffer2 == NULL || buffer3 == NULL || buffer4 == NULL || buffer5 == NULL || buffer6 == NULL)
     {
+        FREE(buffer0);
+        FREE(buffer1);
+        FREE(buffer2);
+        FREE(buffer3);
+        FREE(buffer4);
+        FREE(buffer5);
+        FREE(buffer6);
         return 1;
     }
 
index 3b76113..5d2b5d9 100644 (file)
@@ -262,6 +262,8 @@ types::Function::ReturnValue sci_corr(types::typed_list &in, int _iRetCount, typ
                     if (pDblIn3->isComplex())
                     {
                         Scierror(999, _("%s: Wrong type for input argument #%d: Real matrix expected.\n"), "corr" , 4);
+                        delete[] wi;
+                        delete[] w;
                         return types::Function::Error;
                     }