Skip to content

Commit

Permalink
graph: plug leak
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosmn committed Nov 30, 2012
1 parent 2d6aedb commit da82043
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand All @@ -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,
Expand Down

0 comments on commit da82043

Please sign in to comment.