Download raw body.
Plug Memory Leak in got-read-commit libexec
This is continuing work of commit
866e94146b2586459ca83c90f49ece8c91e1fdff. This plugs a memory leak in
got-read-commit when gets an imsg of type GOT_IMSG_STOP, it attempts to
exit the main loop and leaks the last imsg they received.
diff /home/kyle/src/got
path + /home/kyle/src/got
commit - 5c86702e70cdb94ddc97d82e332b8df785e7de3d
blob - 1c9530650e49205611fe769567650b4ac85a912c
file + libexec/got-read-commit/got-read-commit.c
--- libexec/got-read-commit/got-read-commit.c
+++ libexec/got-read-commit/got-read-commit.c
@@ -80,6 +80,7 @@ main(int argc, char *argv[])
struct imsg imsg;
struct got_commit_object *commit = NULL;
struct got_object_id expected_id;
+ int finished = 0;
int fd = -1;
if (sigint_received) {
@@ -94,8 +95,10 @@ main(int argc, char *argv[])
break;
}
- if (imsg.hdr.type == GOT_IMSG_STOP)
- break;
+ if (imsg.hdr.type == GOT_IMSG_STOP) {
+ finished = 1;
+ goto done;
+ }
if (imsg.hdr.type != GOT_IMSG_COMMIT_REQUEST) {
err = got_error(GOT_ERR_PRIVSEP_MSG);
@@ -125,7 +128,7 @@ done:
if (fd != -1 && close(fd) == -1 && err == NULL)
err = got_error_from_errno("close");
imsg_free(&imsg);
- if (err)
+ if (err || finished)
break;
}
Plug Memory Leak in got-read-commit libexec