mirror of
https://git.proxmox.com/git/libgit2
synced 2025-12-08 06:25:36 +00:00
Fix memory leak in git_tree_walk on error or when stopping the walk from the supplied callback
This commit is contained in:
parent
4e01e3029b
commit
d7fc2eb29b
@ -907,11 +907,12 @@ static int tree_walk(
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
error = tree_walk(subtree, callback, path, payload, preorder);
|
error = tree_walk(subtree, callback, path, payload, preorder);
|
||||||
|
git_tree_free(subtree);
|
||||||
|
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
git_buf_truncate(path, path_len);
|
git_buf_truncate(path, path_len);
|
||||||
git_tree_free(subtree);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preorder && callback(path->ptr, entry, payload) < 0) {
|
if (!preorder && callback(path->ptr, entry, payload) < 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user