jdk/src/java.base/unix/native/libjli/java_md_solinux.c
changeset 42759 0ff64a5b3824
parent 42753 40f61533b93d
parent 42692 97247477b481
child 45062 37ed4313c8c1
child 46846 292be53258b7
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Tue Dec 13 02:04:19 2016 +0100
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Sun Dec 18 15:37:45 2016 +0100
@@ -437,13 +437,13 @@
             return;
         }
 #else
-            JLI_MemFree(newargv);
-            return;
+        JLI_MemFree(newargv);
+        return;
 #endif /* SETENV_REQUIRED */
-    } else {  /* do the same speculatively or exit */
+      } else {  /* do the same speculatively or exit */
         JLI_ReportErrorMessage(JRE_ERROR2, wanted);
         exit(1);
-    }
+      }
 #ifdef SETENV_REQUIRED
         if (mustsetenv) {
             /*
@@ -508,25 +508,25 @@
 #endif /* __solaris__ */
 
             /* runpath contains current effective LD_LIBRARY_PATH setting */
-
-            jvmpath = JLI_StringDup(jvmpath);
-            new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
-                    2 * JLI_StrLen(jrepath) +
+            { /* New scope to declare local variable */
+              char *new_jvmpath = JLI_StringDup(jvmpath);
+              new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
+                      2 * JLI_StrLen(jrepath) +
 #ifdef AIX
-                    /* On AIX we additionally need 'jli' in the path because ld doesn't support $ORIGIN. */
-                    JLI_StrLen(jrepath) + JLI_StrLen("/lib//jli:") +
+                      /* On AIX we additionally need 'jli' in the path because ld doesn't support $ORIGIN. */
+                      JLI_StrLen(jrepath) + JLI_StrLen("/lib//jli:") +
 #endif
-                    JLI_StrLen(jvmpath) + 52;
-            new_runpath = JLI_MemAlloc(new_runpath_size);
-            newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "=");
+                      JLI_StrLen(new_jvmpath) + 52;
+              new_runpath = JLI_MemAlloc(new_runpath_size);
+              newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "=");
 
 
-            /*
-             * Create desired LD_LIBRARY_PATH value for target data model.
-             */
-            {
+              /*
+               * Create desired LD_LIBRARY_PATH value for target data model.
+               */
+              {
                 /* remove the name of the .so from the JVM path */
-                lastslash = JLI_StrRChr(jvmpath, '/');
+                lastslash = JLI_StrRChr(new_jvmpath, '/');
                 if (lastslash)
                     *lastslash = '\0';
 
@@ -537,7 +537,7 @@
                         "%s/lib/jli:" /* Needed on AIX because ld doesn't support $ORIGIN. */
 #endif
                         "%s/../lib",
-                        jvmpath,
+                        new_jvmpath,
                         jrepath,
 #ifdef AIX
                         jrepath,
@@ -545,6 +545,7 @@
                         jrepath
                         );
 
+                JLI_MemFree(new_jvmpath);
 
                 /*
                  * Check to make sure that the prefix of the current path is the
@@ -564,6 +565,7 @@
                     JLI_MemFree(new_runpath);
                     return;
                 }
+              }
             }
 
             /*