Coverity #1097665, #1099399, #1247373 fixed 75/18375/3
Dhruv Khattar [Sun, 17 Jul 2016 19:45:44 +0000 (00:45 +0530)]
Change-Id: I2e42ef2b895774e21d98adc7e93598a1404af21a

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

index a2d34e6..48442e4 100644 (file)
@@ -68,7 +68,10 @@ JavaVM *getScilabJavaVM(void)
         if (!hasJvmSymbolsLoaded())
         {
             /* We load symbols of the current jvm already used */
-            LoadFunctionsJVM(NULL);
+            if (!LoadFunctionsJVM(NULL))
+            {
+                return NULL;
+            }
         }
 
         SciJNI_GetCreatedJavaVMs(vmBuf, 1, &size);
index 2c484fe..af1991d 100644 (file)
@@ -116,12 +116,6 @@ JavaVMOption * getJvmOptions(char *SCI_PATH, char *filename_xml_conf, int *size_
                         char *option_string_sci_path = NULL;
 
                         option_string_path_separator = strsub(jvm_option_string, "$PATH_SEPARATOR", PATH_SEPARATOR);
-
-                        if (jvm_option_string)
-                        {
-                            FREE(jvm_option_string);
-                        }
-
                         option_string_sci_path = strsub(option_string_path_separator, "$SCILAB", SCI_PATH);
                         if (option_string_path_separator)
                         {
@@ -132,7 +126,11 @@ JavaVMOption * getJvmOptions(char *SCI_PATH, char *filename_xml_conf, int *size_
                         jvm_options[indice].optionString = option_string_sci_path;
                         indice++;
                     }
-
+                    if (jvm_option_string)
+                    {
+                        FREE(jvm_option_string);
+                        jvm_option_string = NULL;
+                    }
                 }
 
                 FREE(heapSize);