Commit 050af8bb by Rémi Duraffort

pack: fix memory leak in error path

parent 8d6ef4bf
...@@ -505,8 +505,10 @@ static git_pobject **compute_write_order(git_packbuilder *pb) ...@@ -505,8 +505,10 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
/* /*
* Mark objects that are at the tip of tags. * 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; return NULL;
}
/* /*
* Give the objects in the original recency order until * Give the objects in the original recency order until
......
...@@ -329,8 +329,10 @@ static int pack_index_open(struct git_pack_file *p) ...@@ -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, p->pack_name, base_len);
memcpy(idx_name + base_len, ".idx", sizeof(".idx")); 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; return error;
}
if (p->index_version == -1) if (p->index_version == -1)
error = pack_index_check(idx_name, p); error = pack_index_check(idx_name, p);
......
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