Coverity Fixes : CID #1098486 #1098468 #1098465 #1098397 35/19235/3
Siddhartha Gairola [Tue, 28 Mar 2017 06:55:43 +0000 (11:55 +0530)]
Change-Id: I50d37b35ca5c340050a3e6c213825c78deb0da9b

scilab/modules/gui/sci_gateway/cpp/sci_ClipBoard.cpp
scilab/modules/gui/sci_gateway/cpp/sci_getlookandfeel.cpp
scilab/modules/gui/sci_gateway/cpp/sci_uigetdir.cpp

index 6118a6e..bbd37b6 100644 (file)
@@ -87,6 +87,7 @@ int sci_ClipBoard(char *fname, void* pvApiCtx)
                     if (createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, output))
                     {
                         freeAllocatedSingleString(param1);
+                        delete[] output;
                         Scierror(999, _("%s: Memory allocation error.\n"), fname);
                         return 1;
                     }
index 36bc9a8..4751651 100644 (file)
@@ -55,6 +55,11 @@ int sci_getlookandfeel(char *fname, void* pvApiCtx)
 
             if (createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 1, look))
             {
+                if (look)
+                {
+                    delete[] look;
+                    look = NULL;
+                }
                 Scierror(999, _("%s: Memory allocation error.\n"), fname);
                 return 1;
             }
index 4aa71b4..5443253 100644 (file)
@@ -147,6 +147,15 @@ int sci_uigetdir(char *fname, void* pvApiCtx)
         return 1;
     }
 
+    if (expandedpath)
+    {
+        FREE(expandedpath);
+    }
+    if (title)
+    {
+        FREE(title);
+    }
+
     if (nbRow != 0)
     {
         /* The user selected a file --> returns the files names */