From 038b1815d0ab1a8c0aab4d6cfc18541df5c6cd33 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 27 Dec 2012 02:38:11 -0600 Subject: util/pactree: correctly free the deps list in walk_deps() If we are reversed, then we were correctly freeing both the list and the contained data. However, we were leaking a list in the case of a non-reversed traversal. Signed-off-by: Dan McGee Signed-off-by: Allan McRae --- src/util/pactree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/util') diff --git a/src/util/pactree.c b/src/util/pactree.c index 0c1710f6..9125f581 100644 --- a/src/util/pactree.c +++ b/src/util/pactree.c @@ -472,7 +472,7 @@ static void walk_deps(alpm_list_t *dblist, alpm_pkg_t *pkg, tdepth *depth, int r depth->next = &d; /* last dep, cut off the limb here */ if(last){ - if(depth->prev){ + if(depth->prev) { depth->prev->next = &d; d.prev = depth->prev; depth = &d; @@ -488,6 +488,8 @@ static void walk_deps(alpm_list_t *dblist, alpm_pkg_t *pkg, tdepth *depth, int r if(rev) { FREELIST(deps); + } else { + alpm_list_free(deps); } } -- cgit v1.2.3-24-g4f1b