summaryrefslogtreecommitdiff
path: root/revision.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2019-11-22 08:37:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-11-25 02:48:48 (GMT)
commit0aa0c2b2ec12c91a122aec7a8497fe3577529eba (patch)
tree617be167f7d8719d3da6a00b74ab897af3a942c6 /revision.c
parentffa1f28fea000312ac917874db40f7b298458ef5 (diff)
downloadgit-0aa0c2b2ec12c91a122aec7a8497fe3577529eba.zip
git-0aa0c2b2ec12c91a122aec7a8497fe3577529eba.tar.gz
git-0aa0c2b2ec12c91a122aec7a8497fe3577529eba.tar.bz2
revision: free topo_walk_info before creating a new one in init_topo_walk
init_topo_walk doesn't reuse an existing topo_walk_info, and currently leaks the one that might exist on the current rev_info if it was already used for a topo walk beforehand. Signed-off-by: Mike Hommey <mh@glandium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'revision.c')
-rw-r--r--revision.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/revision.c b/revision.c
index 4827360..fb93c99 100644
--- a/revision.c
+++ b/revision.c
@@ -3201,10 +3201,26 @@ static void compute_indegrees_to_depth(struct rev_info *revs,
indegree_walk_step(revs);
}
+static void reset_topo_walk(struct rev_info *revs)
+{
+ struct topo_walk_info *info = revs->topo_walk_info;
+
+ clear_prio_queue(&info->explore_queue);
+ clear_prio_queue(&info->indegree_queue);
+ clear_prio_queue(&info->topo_queue);
+ clear_indegree_slab(&info->indegree);
+ clear_author_date_slab(&info->author_date);
+
+ FREE_AND_NULL(revs->topo_walk_info);
+}
+
static void init_topo_walk(struct rev_info *revs)
{
struct topo_walk_info *info;
struct commit_list *list;
+ if (revs->topo_walk_info)
+ reset_topo_walk(revs);
+
revs->topo_walk_info = xmalloc(sizeof(struct topo_walk_info));
info = revs->topo_walk_info;
memset(info, 0, sizeof(struct topo_walk_info));