mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-21 18:24:43 +00:00
Always free the parents of a revwalk commit
Thanks to Carlos Martín Nieto for spotting this.
This commit is contained in:
parent
1881f0783b
commit
21d73e7195
@ -482,11 +482,22 @@ int git_revwalk_new(git_revwalk **revwalk_out, git_repository *repo)
|
|||||||
void git_revwalk_free(git_revwalk *walk)
|
void git_revwalk_free(git_revwalk *walk)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
const void *_unused;
|
||||||
|
commit_object *commit;
|
||||||
|
|
||||||
if (walk == NULL)
|
if (walk == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
git_revwalk_reset(walk);
|
git_revwalk_reset(walk);
|
||||||
|
|
||||||
|
/* if the parent has more than PARENTS_PER_COMMIT parents,
|
||||||
|
* we had to allocate a separate array for those parents.
|
||||||
|
* make sure it's being free'd */
|
||||||
|
GIT_HASHTABLE_FOREACH(walk->commits, _unused, commit, {
|
||||||
|
if (commit->out_degree > PARENTS_PER_COMMIT)
|
||||||
|
free(commit->parents);
|
||||||
|
});
|
||||||
|
|
||||||
git_hashtable_free(walk->commits);
|
git_hashtable_free(walk->commits);
|
||||||
git_pqueue_free(&walk->iterator_time);
|
git_pqueue_free(&walk->iterator_time);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user