Commit c6451624 by Rémi Duraffort

Fix some more memory leaks in error path

parent 050af8bb
...@@ -1902,8 +1902,10 @@ static int write_merge_msg( ...@@ -1902,8 +1902,10 @@ static int write_merge_msg(
entries = git__calloc(heads_len, sizeof(struct merge_msg_entry)); entries = git__calloc(heads_len, sizeof(struct merge_msg_entry));
GITERR_CHECK_ALLOC(entries); 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; return -1;
}
for (i = 0; i < heads_len; i++) for (i = 0; i < heads_len; i++)
entries[i].merge_head = heads[i]; entries[i].merge_head = heads[i];
......
...@@ -232,6 +232,7 @@ int git_odb__hashlink(git_oid *out, const char *path) ...@@ -232,6 +232,7 @@ int git_odb__hashlink(git_oid *out, const char *path)
link_data[size] = '\0'; link_data[size] = '\0';
if (read_len != (ssize_t)size) { if (read_len != (ssize_t)size) {
giterr_set(GITERR_OS, "Failed to read symlink data for '%s'", path); giterr_set(GITERR_OS, "Failed to read symlink data for '%s'", path);
git__free(link_data);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment