diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-03-16 01:04:17 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-03-16 01:04:17 +0200 |
commit | 36b313296638f8ae349e400ba9a7f5bbfb92b96f (patch) | |
tree | b8f5b9542f7b5e29509d4e8c914c7ad3199ae370 | |
parent | f73b09cd9a36e1d02fe5b6ad33053e60ac88bc7a (diff) | |
download | libgit2-36b313296638f8ae349e400ba9a7f5bbfb92b96f.tar.gz |
Properly free commit a commit list in revwalk
The commit list was not being properly free'd when a walk was stopped
halfway through.
-rw-r--r-- | src/revwalk.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/revwalk.c b/src/revwalk.c index edafbe73d..d17b44053 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -78,13 +78,17 @@ commit_list *commit_list_insert(commit_object *item, commit_list **list_p) return new_list; } -void commit_list_free(commit_list *list) +void commit_list_free(commit_list **list_p) { + commit_list *list = *list_p; + while (list) { commit_list *temp = list; list = temp->next; free(temp); } + + *list_p = NULL; } commit_object *commit_list_pop(commit_list **stack) @@ -561,9 +565,9 @@ void git_revwalk_reset(git_revwalk *walk) ); git_pqueue_free(&walk->iterator_time); - commit_list_free(walk->iterator_topo); - commit_list_free(walk->iterator_rand); - commit_list_free(walk->iterator_reverse); + commit_list_free(&walk->iterator_topo); + commit_list_free(&walk->iterator_rand); + commit_list_free(&walk->iterator_reverse); walk->walking = 0; } |