From: Mikhail Subject: Memory leak in got_fetch_pack() To: gameoftrees@openbsd.org Date: Wed, 23 Mar 2022 22:09:27 +0300 During exploration of the code, I came across little memory leak. We malloc() the memory in got_object_id_str (lib/fetch.c:489), but never free() it. Please, assess the patch. diff refs/heads/main refs/heads/id_str blob - e557ed1517eb0150936c27521720d73e1dc76d88 blob + c6a947cc4002d0ef7d26469a37cfd819bb827897 --- lib/fetch.c +++ lib/fetch.c @@ -500,6 +500,8 @@ got_fetch_pack(struct got_object_id **pack_hash, struc err = got_error_from_errno("asprintf"); goto done; } + free(id_str); + id_str = NULL; if (rename(tmppackpath, packpath) == -1) { err = got_error_from_errno3("rename", tmppackpath, packpath); @@ -534,6 +536,7 @@ done: free(tmppackpath); free(tmpidxpath); free(idxpath); + free(id_str); free(packpath); free(progress);