Skip to content

Commit

Permalink
8311645: Memory leak in jspawnhelper spawnChild after JDK-8307990
Browse files Browse the repository at this point in the history
Backport-of: 401c3dea5d8823bc9c0f40506ddad46e983ebf68
  • Loading branch information
simonis committed Dec 7, 2023
1 parent af0f057 commit 9bf8c2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/java.base/unix/native/libjava/ProcessImpl_md.c
Expand Up @@ -565,6 +565,7 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)

/* write the two structs and the data buffer */
if (writeFully(c->childenv[1], (char *)&magic, sizeof(magic)) != sizeof(magic)) { // magic number first
free(buf);
return -1;
}
#ifdef DEBUG
Expand All @@ -573,6 +574,7 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
if (writeFully(c->childenv[1], (char *)c, sizeof(*c)) != sizeof(*c) ||
writeFully(c->childenv[1], (char *)&sp, sizeof(sp)) != sizeof(sp) ||
writeFully(c->childenv[1], buf, bufsize) != bufsize) {
free(buf);
return -1;
}
/* We're done. Let jspwanhelper know he can't expect any more data from us. */
Expand Down

1 comment on commit 9bf8c2e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.