commit 46f2b277e08063e0367378a880286d33f61a9b22 from: Kyle Ackerman via: Thomas Adam date: Thu Nov 14 16:16:05 2024 UTC plug a memory leak in got_pack_create() Patch by: Kyle Ackerman commit - 26eea884dfbcf5c11ea6783e71ed280c25932048 commit + 46f2b277e08063e0367378a880286d33f61a9b22 blob - 8651030eabbb32fc311740f7141bd62cba295f22 blob + 99c0a1b716240c3a598a85d75ad9eb6caaa3ff9e --- lib/pack_create.c +++ lib/pack_create.c @@ -1083,6 +1083,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) { @@ -1950,6 +1962,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;