summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRémi Duraffort <ivoire@videolan.org>2013-07-15 16:00:07 +0200
committerRémi Duraffort <ivoire@videolan.org>2013-07-15 16:29:18 +0200
commitc6451624c4631ccf039d0f3d5af6fbf4364f001c (patch)
tree1f04e39cdad62d509267b7ed144bd583d618b320 /src
parent050af8bbe08b7cab7bfce044dcb51fb61ff1dc41 (diff)
downloadlibgit2-c6451624c4631ccf039d0f3d5af6fbf4364f001c.tar.gz
Fix some more memory leaks in error path
Diffstat (limited to 'src')
-rw-r--r--src/merge.c4
-rw-r--r--src/odb.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/merge.c b/src/merge.c
index 82d2e6f37..2e94ce1cd 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -1902,8 +1902,10 @@ static int write_merge_msg(
entries = git__calloc(heads_len, sizeof(struct merge_msg_entry));
GITERR_CHECK_ALLOC(entries);
- if (git_vector_init(&matching, heads_len, NULL) < 0)
+ if (git_vector_init(&matching, heads_len, NULL) < 0) {
+ git__free(entries);
return -1;
+ }
for (i = 0; i < heads_len; i++)
entries[i].merge_head = heads[i];
diff --git a/src/odb.c b/src/odb.c
index 8e62efd00..23eb4e12e 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -232,6 +232,7 @@ int git_odb__hashlink(git_oid *out, const char *path)
link_data[size] = '\0';
if (read_len != (ssize_t)size) {
giterr_set(GITERR_OS, "Failed to read symlink data for '%s'", path);
+ git__free(link_data);
return -1;
}