CID 1372135 & 1372136 fixed 82/19182/1
Paul Bignier [Mon, 13 Mar 2017 08:11:28 +0000 (09:11 +0100)]
Change-Id: I023a3fa50018b97a6a11a100a3ccad5c7244c738

scilab/modules/gui/sci_gateway/cpp/sci_uiputfile.cpp
scilab/modules/string/src/c/strsubst.c

index a00479c..0e0ffff 100644 (file)
@@ -41,12 +41,12 @@ static int deleteArrayOfString(char **Str, int dim)
 {
     int ret = 1;
 
-    if(Str)
+    if (Str)
     {
         int i = 0;
-        for(i = 0; i < dim; i++)
+        for (i = 0; i < dim; i++)
         {
-            if(Str[i])
+            if (Str[i])
             {
                 delete Str[i];
                 Str[i] = NULL;
@@ -282,9 +282,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
             Scierror(999, _("%s: Memory allocation error.\n"), fname);
             ret = deleteArrayOfString(selection, selectionSize);
             ret = deleteArrayOfString(selectionFileNames, selectionSize);
-            if(selectionPathName)
+            if (selectionPathName)
             {
-                delete selectionPathName;
+                delete[] selectionPathName;
                 selectionPathName = NULL;
             }
             return 1;
@@ -302,9 +302,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
                 Scierror(999, _("%s: Memory allocation error.\n"), fname);
                 ret = deleteArrayOfString(selection, selectionSize);
                 ret = deleteArrayOfString(selectionFileNames, selectionSize);
-                if(selectionPathName)
+                if (selectionPathName)
                 {
-                    delete selectionPathName;
+                    delete[] selectionPathName;
                     selectionPathName = NULL;
                 }
                 return 1;
@@ -324,9 +324,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
                 Scierror(999, _("%s: Memory allocation error.\n"), fname);
                 ret = deleteArrayOfString(selection, selectionSize);
                 ret = deleteArrayOfString(selectionFileNames, selectionSize);
-                if(selectionPathName)
+                if (selectionPathName)
                 {
-                    delete selectionPathName;
+                    delete[] selectionPathName;
                     selectionPathName = NULL;
                 }
                 return 1;
@@ -338,9 +338,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
         ReturnArguments(pvApiCtx);
         ret = deleteArrayOfString(selection, selectionSize);
         ret = deleteArrayOfString(selectionFileNames, selectionSize);
-        if(selectionPathName)
+        if (selectionPathName)
         {
-            delete selectionPathName;
+            delete[] selectionPathName;
             selectionPathName = NULL;
         }
         return 0;
@@ -356,9 +356,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
             Scierror(999, _("%s: Memory allocation error.\n"), fname);
             ret = deleteArrayOfString(selection, selectionSize);
             ret = deleteArrayOfString(selectionFileNames, selectionSize);
-            if(selectionPathName)
+            if (selectionPathName)
             {
-                delete selectionPathName;
+                delete[] selectionPathName;
                 selectionPathName = NULL;
             }
             return 1;
@@ -368,9 +368,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
         ReturnArguments(pvApiCtx);
         ret = deleteArrayOfString(selection, selectionSize);
         ret = deleteArrayOfString(selectionFileNames, selectionSize);
-        if(selectionPathName)
+        if (selectionPathName)
         {
-            delete selectionPathName;
+            delete[] selectionPathName;
             selectionPathName = NULL;
         }
         return 0;
@@ -384,9 +384,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
         Scierror(999, _("%s: Memory allocation error.\n"), fname);
         ret = deleteArrayOfString(selection, selectionSize);
         ret = deleteArrayOfString(selectionFileNames, selectionSize);
-        if(selectionPathName)
+        if (selectionPathName)
         {
-            delete selectionPathName;
+            delete[] selectionPathName;
             selectionPathName = NULL;
         }
         return 1;
@@ -397,9 +397,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
         printError(&sciErr, 0);
         ret = deleteArrayOfString(selection, selectionSize);
         ret = deleteArrayOfString(selectionFileNames, selectionSize);
-        if(selectionPathName)
+        if (selectionPathName)
         {
-            delete selectionPathName;
+            delete[] selectionPathName;
             selectionPathName = NULL;
         }
         return 1;
@@ -415,9 +415,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
             printError(&sciErr, 0);
             ret = deleteArrayOfString(selection, selectionSize);
             ret = deleteArrayOfString(selectionFileNames, selectionSize);
-            if(selectionPathName)
+            if (selectionPathName)
             {
-                delete selectionPathName;
+                delete[] selectionPathName;
                 selectionPathName = NULL;
             }
             return 1;
@@ -428,9 +428,9 @@ int sci_uiputfile(char *fname, void* pvApiCtx)
     ReturnArguments(pvApiCtx);
     ret = deleteArrayOfString(selection, selectionSize);
     ret = deleteArrayOfString(selectionFileNames, selectionSize);
-    if(selectionPathName)
+    if (selectionPathName)
     {
-        delete selectionPathName;
+        delete[] selectionPathName;
         selectionPathName = NULL;
     }
     return 0;
index 7573b54..169d104 100644 (file)
@@ -300,7 +300,8 @@ wchar_t *wcssub_reg(const wchar_t* _pwstInput, const wchar_t* _pwstSearch, const
             FREE(arriEnd);
             return NULL;
         }
-    } while (iPcreStatus == PCRE_FINISHED_OK && iStart != iEnd);
+    }
+    while (iPcreStatus == PCRE_FINISHED_OK && iStart != iEnd);
 
     if (iOccurs)
     {
@@ -347,11 +348,6 @@ wchar_t *wcssub_reg(const wchar_t* _pwstInput, const wchar_t* _pwstSearch, const
         FREE(arriEnd);
         return os_wcsdup(_pwstInput);
     }
-
-    FREE(arriStart);
-    FREE(arriEnd);
-
-    return NULL;
 }
 /*-------------------------------------------------------------------------------------*/
 wchar_t **wcssubst_reg(const wchar_t** _pwstInput, int _iInputSize, const wchar_t* _pwstSearch, const wchar_t* _pwstReplace, int* _piErr)