From: Stefan Beller <stefanbel...@gmail.com>

Signed-off-by: Stefan Beller <sbel...@google.com>
---
 builtin/pack-redundant.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index 72c8158..c75c5c9 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -223,6 +223,18 @@ static inline size_t pack_list_size(struct pack_list *pl)
        return ret;
 }
 
+static inline void pack_list_free(struct pack_list *pl)
+{
+       struct pack_list *cur_pl;
+       while (pl) {
+               llist_free(pl->unique_objects);
+               llist_free(pl->all_objects);
+               cur_pl = pl;
+               pl = pl->next;
+               free(cur_pl);
+       }
+}
+
 static struct pack_list * pack_list_difference(const struct pack_list *A,
                                               const struct pack_list *B)
 {
@@ -691,5 +703,10 @@ int cmd_pack_redundant(int argc, const char **argv, const 
char *prefix)
                fprintf(stderr, "%luMB of redundant packs in total.\n",
                        (unsigned long)pack_set_bytecount(red)/(1024*1024));
 
+#ifdef FREE_ALL_MEMORY
+       pack_list_free(red);
+       llist_free(ignore);
+#endif
+
        return 0;
 }
-- 
2.8.2.401.g9c0faef

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to