pack: fix memory leak in error path

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

View File

@ -505,8 +505,10 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
/*
* Mark objects that are at the tip of tags.
*/
if (git_tag_foreach(pb->repo, &cb_tag_foreach, pb) < 0)
if (git_tag_foreach(pb->repo, &cb_tag_foreach, pb) < 0) {
git__free(wo);
return NULL;
}
/*
* Give the objects in the original recency order until

View File

@ -329,8 +329,10 @@ static int pack_index_open(struct git_pack_file *p)
memcpy(idx_name, p->pack_name, base_len);
memcpy(idx_name + base_len, ".idx", sizeof(".idx"));
if ((error = git_mutex_lock(&p->lock)) < 0)
if ((error = git_mutex_lock(&p->lock)) < 0) {
git__free(idx_name);
return error;
}
if (p->index_version == -1)
error = pack_index_check(idx_name, p);