Fix some valgrind detected issues 56/18956/2
Clément DAVID [Wed, 25 Jan 2017 12:05:54 +0000 (13:05 +0100)]
Change-Id: I6b0f53e5da1cf2d3bf450f11716c0a359dbf0aa1

scilab/modules/console/src/cpp/ConsoleRead.cpp
scilab/modules/ui_data/src/cpp/BrowseVarManager.cpp

index 4353735..7d6b1e5 100644 (file)
@@ -29,7 +29,7 @@ char *ConsoleRead(void)
 {
     if (line)
     {
-        delete line;
+        delete[] line;
         line = NULL;
     }
     line = CallScilabBridge::readLine(getScilabJavaVM());
index f6ec2f2..578d30a 100644 (file)
@@ -97,17 +97,17 @@ void SetBrowseVarData()
     iLocalVariablesUsed = ctx->getVarsToVariableBrowser(lstVars);
     iLocalVariablesUsed += ctx->getLibsToVariableBrowser(lstLibs);
 
-    char **pstAllVariableNames = new char*[iLocalVariablesUsed];
-    char **pstAllVariableVisibility = new char*[iLocalVariablesUsed];
-    char **pstAllVariableListTypes = new char*[iLocalVariablesUsed];
-    int *piAllVariableBytes = new int[iLocalVariablesUsed];
-    char **pstAllVariableSizes = new char*[iLocalVariablesUsed];
-    int *piAllVariableTypes = new int[iLocalVariablesUsed];
-    int *piAllVariableIntegerTypes = new int[iLocalVariablesUsed];
-    bool *piAllVariableFromUser = new bool[iLocalVariablesUsed];
+    char **pstAllVariableNames = new char*[iLocalVariablesUsed]();
+    char **pstAllVariableVisibility = new char*[iLocalVariablesUsed]();
+    char **pstAllVariableListTypes = new char*[iLocalVariablesUsed]();
+    int *piAllVariableBytes = new int[iLocalVariablesUsed]();
+    char **pstAllVariableSizes = new char*[iLocalVariablesUsed]();
+    int *piAllVariableTypes = new int[iLocalVariablesUsed]();
+    int *piAllVariableIntegerTypes = new int[iLocalVariablesUsed]();
+    bool *piAllVariableFromUser = new bool[iLocalVariablesUsed]();
     /* Necessary for the plots in the var browser */
-    int *piAllVariableNbRows = new int[iLocalVariablesUsed];
-    int *piAllVariableNbCols = new int[iLocalVariablesUsed];
+    int *piAllVariableNbRows = new int[iLocalVariablesUsed]();
+    int *piAllVariableNbCols = new int[iLocalVariablesUsed]();
 
     int nbRows, nbCols;
     char *sizeStr = NULL;