jdk/src/java.base/unix/native/libjli/java_md_solinux.c
changeset 42687 7a5929518e6a
parent 40945 f241705723ea
child 42692 97247477b481
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Tue Dec 13 18:47:23 2016 -0800
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Fri Dec 02 15:02:10 2016 +0100
@@ -444,13 +444,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) {
             /*
@@ -516,14 +516,14 @@
 
             /* runpath contains current effective LD_LIBRARY_PATH setting */
 
-            jvmpath = JLI_StringDup(jvmpath);
+            char *new_jvmpath = JLI_StringDup(jvmpath);
             new_runpath_size = ((runpath != NULL) ? JLI_StrLen(runpath) : 0) +
                     2 * JLI_StrLen(jrepath) + 2 * JLI_StrLen(arch) +
 #ifdef AIX
                     /* On AIX we additionally need 'jli' in the path because ld doesn't support $ORIGIN. */
                     JLI_StrLen(jrepath) + JLI_StrLen(arch) + JLI_StrLen("/lib//jli:") +
 #endif
-                    JLI_StrLen(jvmpath) + 52;
+                    JLI_StrLen(new_jvmpath) + 52;
             new_runpath = JLI_MemAlloc(new_runpath_size);
             newpath = new_runpath + JLI_StrLen(LD_LIBRARY_PATH "=");
 
@@ -533,7 +533,7 @@
              */
             {
                 /* remove the name of the .so from the JVM path */
-                lastslash = JLI_StrRChr(jvmpath, '/');
+                lastslash = JLI_StrRChr(new_jvmpath, '/');
                 if (lastslash)
                     *lastslash = '\0';
 
@@ -544,7 +544,7 @@
                         "%s/lib/%s/jli:" /* Needed on AIX because ld doesn't support $ORIGIN. */
 #endif
                         "%s/../lib/%s",
-                        jvmpath,
+                        new_jvmpath,
                         jrepath, arch,
 #ifdef AIX
                         jrepath, arch,
@@ -552,6 +552,7 @@
                         jrepath, arch
                         );
 
+                JLI_MemFree(new_jvmpath);
 
                 /*
                  * Check to make sure that the prefix of the current path is the