commit ff17000ba9063dacc7353e37abd8aeedbcd2e4a8 from: Stefan Sperling date: Sat Dec 28 13:29:51 2024 UTC plug imsgbuf-related memory leak in got_repo_index_pack() commit - bb37821d8be3472e9ba61fec1f4675eba1465260 commit + ff17000ba9063dacc7353e37abd8aeedbcd2e4a8 blob - 6c74bdbaad86d5fa1835fd9ad75731dd69cd638b blob + ba9e6ae53cbffd025f1157b73322e282138bf3d3 --- lib/repository_admin.c +++ lib/repository_admin.c @@ -289,6 +289,8 @@ got_repo_index_pack(FILE *packfile, struct got_object_ char *packfile_path = NULL, *idxpath = NULL, *id_str = NULL; const char *repo_path = got_repo_get_path_git_dir(repo); struct stat sb; + + memset(&idxibuf, 0, sizeof(idxibuf)); for (i = 0; i < nitems(tmpfds); i++) tmpfds[i] = -1; @@ -422,6 +424,8 @@ got_repo_index_pack(FILE *packfile, struct got_object_ tmpidxpath = NULL; done: + if (idxibuf.w) + imsgbuf_clear(&idxibuf); if (tmpidxpath && unlink(tmpidxpath) == -1 && err == NULL) err = got_error_from_errno2("unlink", tmpidxpath); if (npackfd != -1 && close(npackfd) == -1 && err == NULL)