commit 9c1b133592069eb8885b5bec922d06995ece91e1 from: Kyle Ackerman via: Stefan Sperling date: Tue Nov 12 12:21:33 2024 UTC plug a memory leak in got_pack_create() Patch by: Kyle Ackerman commit - 6d00e361b51b0e4d5aabc05aebef7ecb6b7d4392 commit + 9c1b133592069eb8885b5bec922d06995ece91e1 blob - 15f0b91bc626701388d1ce14abb9f0437fe5676e blob + 892d80d152938a8113afdc25ce1a4e47b6b3288b --- lib/pack_create.c +++ lib/pack_create.c @@ -1086,6 +1086,18 @@ append_id(struct got_object_id *id, void *data, void * } static const struct got_error * +free_meta(struct got_object_id *id, void *data, void *arg) +{ + struct got_pack_meta *meta = data; + if (meta){ + clear_meta(meta); + free(meta); + } + + return NULL; +} + +static const struct got_error * queue_commit_or_tag_id(struct got_object_id *id, intptr_t color, struct got_object_id_queue *ids, struct got_repository *repo) { @@ -1953,6 +1965,7 @@ got_pack_create(struct got_object_id *packhash, int pa done: free_nmeta(deltify.meta, deltify.nmeta); free_nmeta(reuse.meta, reuse.nmeta); + got_object_idset_for_each(idset, free_meta, NULL); got_object_idset_free(idset); got_repo_unpin_pack(repo); return err;