Fix some more memory leaks in error path

This commit is contained in:
Rémi Duraffort 2013-07-15 16:00:07 +02:00
parent 050af8bbe0
commit c6451624c4
2 changed files with 4 additions and 1 deletions

View File

@ -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];

View File

@ -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;
} }