mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-12 12:00:29 +00:00
tree: free in error conditions
As reported by coverity, we would leak some memory in error conditions.
This commit is contained in:
parent
5e0f47c375
commit
966fb20702
@ -466,6 +466,7 @@ static int append_entry(
|
|||||||
|
|
||||||
git_strmap_insert(bld->map, entry->filename, entry, error);
|
git_strmap_insert(bld->map, entry->filename, entry, error);
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
|
git_tree_entry_free(entry);
|
||||||
giterr_set(GITERR_TREE, "failed to append entry %s to the tree builder", filename);
|
giterr_set(GITERR_TREE, "failed to append entry %s to the tree builder", filename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -622,6 +623,7 @@ int git_treebuilder_create(git_treebuilder **builder_p, const git_tree *source)
|
|||||||
GITERR_CHECK_ALLOC(bld);
|
GITERR_CHECK_ALLOC(bld);
|
||||||
|
|
||||||
if (git_strmap_alloc(&bld->map) < 0) {
|
if (git_strmap_alloc(&bld->map) < 0) {
|
||||||
|
git__free(bld);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user