commit bb37821d8be3472e9ba61fec1f4675eba1465260 from: Stefan Sperling date: Sat Dec 28 13:26:40 2024 UTC plug imsgbuf-related memory leaks in got_fetch_pack() commit - f0a58e8988234f4595ddc5deb1c38d5aa2408492 commit + bb37821d8be3472e9ba61fec1f4675eba1465260 blob - 4e0331d997a587a82491c0c1835d0ae523400561 blob + 59805003b987f3c15b36a7b1612cf1bfc9128fb0 --- lib/fetch.c +++ lib/fetch.c @@ -136,6 +136,8 @@ got_fetch_pack(struct got_object_id **pack_hash, struc char *progress = NULL; *pack_hash = NULL; + memset(&fetchibuf, 0, sizeof(fetchibuf)); + memset(&idxibuf, 0, sizeof(idxibuf)); if (repo && got_repo_get_object_format(repo) != GOT_HASH_SHA1) return got_error_fmt(GOT_ERR_NOT_IMPL, @@ -548,6 +550,10 @@ got_fetch_pack(struct got_object_id **pack_hash, struc tmpidxpath = NULL; done: + if (fetchibuf.w) + imsgbuf_clear(&fetchibuf); + if (idxibuf.w) + imsgbuf_clear(&idxibuf); if (tmppackpath && unlink(tmppackpath) == -1 && err == NULL) err = got_error_from_errno2("unlink", tmppackpath); if (tmpidxpath && unlink(tmpidxpath) == -1 && err == NULL)