commit 13f83e7680d8f12b263590a1c1d4f1d1d1e078ccea36b0baa5251dd0240932ae from: Stefan Sperling date: Sat Dec 28 13:26:40 2024 UTC plug imsgbuf-related memory leaks in got_fetch_pack() commit - 0069f59b6ce40515277370437bc9e457fc4531d1922166004dd60cf971f04f7d commit + 13f83e7680d8f12b263590a1c1d4f1d1d1e078ccea36b0baa5251dd0240932ae blob - 9b193bf3ae085b4962e47b58c969e30e186ca183f673160e9f243155f408a6ed blob + d3a57581f46828bbb15b873db631842c628eaed98e2e437a29c43430efd4408c --- 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)