summaryrefslogtreecommitdiff
path: root/src/graph.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2012-11-30 15:26:45 +0100
committerCarlos Martín Nieto <cmn@elego.de>2012-11-30 15:26:45 +0100
commitda820437368aae2088e992e7ce8944253693aa16 (patch)
tree1a306fb375c5b7a756923c9c2075319f1258f427 /src/graph.c
parent2d6aedbf295e6379faa56c68f8d5e31d3f4d796c (diff)
downloadlibgit2-da820437368aae2088e992e7ce8944253693aa16.tar.gz
graph: plug leak
Diffstat (limited to 'src/graph.c')
-rw-r--r--src/graph.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/graph.c b/src/graph.c
index 28026d4b4..fd789d65e 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -22,9 +22,9 @@ static int ahead_behind(git_commit_list_node *one, git_commit_list_node *two,
if (git_pqueue_init(&pq, 2, git_commit_list_time_cmp) < 0)
return -1;
if (git_pqueue_insert(&pq, one) < 0)
- return -1;
+ goto on_error;
if (git_pqueue_insert(&pq, two) < 0)
- return -1;
+ goto on_error;
while ((commit = git_pqueue_pop(&pq)) != NULL) {
if (commit->flags & RESULT ||
@@ -43,7 +43,12 @@ static int ahead_behind(git_commit_list_node *one, git_commit_list_node *two,
commit->flags |= RESULT;
}
+ git_pqueue_free(&pq);
return 0;
+
+on_error:
+ git_pqueue_free(&pq);
+ return -1;
}
int git_graph_ahead_behind(size_t *ahead, size_t *behind, git_repository *repo,