8311645: Memory leak in jspawnhelper spawnChild after JDK-8307990

Reviewed-by: shade, simonis, alanb, rriggs
This commit is contained in:
Jenny Shivayogi 2023-07-11 16:55:23 +00:00 committed by Aleksey Shipilev
parent e154b0d6cd
commit 401c3dea5d

View file

@ -562,6 +562,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
@ -570,6 +571,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. */