Coverity #1247373, #1357841 fixed 08/18408/2
Dhruv Khattar [Thu, 4 Aug 2016 07:44:43 +0000 (12:44 +0530)]
Change-Id: Ibbb252c5cebf13b4506a220b46097d88b9495dd3

scilab/modules/jvm/src/c/JVM.c
scilab/modules/jvm/src/c/getJvmOptions.c

index 48442e4..38a4363 100644 (file)
@@ -70,6 +70,7 @@ JavaVM *getScilabJavaVM(void)
             /* We load symbols of the current jvm already used */
             if (!LoadFunctionsJVM(NULL))
             {
+                FREE(vmBuf);
                 return NULL;
             }
         }
index af1991d..a5f1924 100644 (file)
@@ -98,6 +98,11 @@ JavaVMOption * getJvmOptions(char *SCI_PATH, char *filename_xml_conf, int *size_
                         {
                             /* we found the tag name */
                             const char *str = (const char*)attrib->children->content;
+                            if (jvm_option_string)
+                            {
+                                FREE(jvm_option_string);
+                                jvm_option_string = NULL;
+                            }
                             if (strstr(str, "-Xmx") == str && heapSize)
                             {
                                 jvm_option_string = os_strdup(heapSize);