commit 98b30215d8c79f83be9b85aca9b58626d95b7eb1 from: Stefan Sperling via: Thomas Adam date: Mon Jun 13 17:55:22 2022 UTC imsg_add() already frees wbuf on error; pointed out by op@ commit - 132807502fb70f1d13642b327d151710a47f01e1 commit + 98b30215d8c79f83be9b85aca9b58626d95b7eb1 blob - 959ffb5044684cd3ec9c315cc77d229998054079 blob + 0e59c1cb7d34e3d7972479b6df2edade3cf172d2 --- lib/privsep.c +++ lib/privsep.c @@ -2769,21 +2769,12 @@ got_privsep_send_enumerated_tree(size_t *totlen, struc if (wbuf == NULL) return got_error_from_errno("imsg_create ENUMERATED_TREE"); - if (imsg_add(wbuf, tree_id->sha1, SHA1_DIGEST_LENGTH) == -1) { - err = got_error_from_errno("imsg_add ENUMERATED_TREE"); - ibuf_free(wbuf); - return err; - } - if (imsg_add(wbuf, &nentries, sizeof(nentries)) == -1) { - err = got_error_from_errno("imsg_add ENUMERATED_TREE"); - ibuf_free(wbuf); - return err; - } - if (imsg_add(wbuf, path, path_len) == -1) { - err = got_error_from_errno("imsg_add ENUMERATED_TREE"); - ibuf_free(wbuf); - return err; - } + if (imsg_add(wbuf, tree_id->sha1, SHA1_DIGEST_LENGTH) == -1) + return got_error_from_errno("imsg_add ENUMERATED_TREE"); + if (imsg_add(wbuf, &nentries, sizeof(nentries)) == -1) + return got_error_from_errno("imsg_add ENUMERATED_TREE"); + if (imsg_add(wbuf, path, path_len) == -1) + return got_error_from_errno("imsg_add ENUMERATED_TREE"); wbuf->fd = -1; imsg_close(ibuf, wbuf);