8054841: (process) ProcessBuilder leaks native memory
authorigerasim
Tue, 12 Aug 2014 00:13:57 +0400
changeset 25980 76e7de7a6ef7
parent 25979 42e5d9f8087e
child 25981 ae524ae51679
8054841: (process) ProcessBuilder leaks native memory Reviewed-by: rriggs, alanb
jdk/src/solaris/native/java/lang/UNIXProcess_md.c
--- a/jdk/src/solaris/native/java/lang/UNIXProcess_md.c	Mon Aug 11 21:03:59 2014 +0100
+++ b/jdk/src/solaris/native/java/lang/UNIXProcess_md.c	Tue Aug 12 00:13:57 2014 +0400
@@ -599,9 +599,9 @@
      */
     assert(prog != NULL && argBlock != NULL);
     if ((phelperpath = getBytes(env, helperpath))   == NULL) goto Catch;
-    if ((pprog     = getBytes(env, prog))       == NULL) goto Catch;
-    if ((pargBlock = getBytes(env, argBlock))   == NULL) goto Catch;
-    if ((c->argv = NEW(const char *, argc + 3)) == NULL) goto Catch;
+    if ((pprog       = getBytes(env, prog))         == NULL) goto Catch;
+    if ((pargBlock   = getBytes(env, argBlock))     == NULL) goto Catch;
+    if ((c->argv     = NEW(const char *, argc + 3)) == NULL) goto Catch;
     c->argv[0] = pprog;
     c->argc = argc + 2;
     initVectorFromBlock(c->argv+1, pargBlock, argc);
@@ -690,10 +690,11 @@
     closeSafely(childenv[0]);
     closeSafely(childenv[1]);
 
-    releaseBytes(env, prog,     pprog);
-    releaseBytes(env, argBlock, pargBlock);
-    releaseBytes(env, envBlock, penvBlock);
-    releaseBytes(env, dir,      c->pdir);
+    releaseBytes(env, helperpath, phelperpath);
+    releaseBytes(env, prog,       pprog);
+    releaseBytes(env, argBlock,   pargBlock);
+    releaseBytes(env, envBlock,   penvBlock);
+    releaseBytes(env, dir,        c->pdir);
 
     free(c->argv);
     free(c->envv);