commit c6e52065d2d29f5a1100b031055492a4389193449ebaf1850d219f3bb0bd0e24 from: Stefan Sperling date: Sat Dec 28 13:29:51 2024 UTC plug imsgbuf-related memory leak in got_repo_index_pack() commit - 13f83e7680d8f12b263590a1c1d4f1d1d1e078ccea36b0baa5251dd0240932ae commit + c6e52065d2d29f5a1100b031055492a4389193449ebaf1850d219f3bb0bd0e24 blob - 85ead8fc4e795be381be15af695d2b6d499afc6b2cad8392bc0d4807172c013f blob + af0d17d4eca8a2e0905047c95a1314728e9e6c21f741bd50753c8be07785dda5 --- lib/repository_admin.c +++ lib/repository_admin.c @@ -290,6 +290,8 @@ got_repo_index_pack(FILE *packfile, struct got_object_ 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)