diff options
author | Russell Belfer <rb@github.com> | 2013-12-12 04:56:17 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-12-12 04:56:17 +0400 |
commit | 7e3ed419593a2dc9fae3bd69fdf172de015d79d9 (patch) | |
tree | b48a9d0bd341a311eed787a65aa442452bfef518 /src/pack-objects.c | |
parent | 7697e54176ccab22ed6d4597d7256e9a1e6ff202 (diff) |
Fix up some valgrind leaks and warnings
Diffstat (limited to 'src/pack-objects.c')
-rw-r--r-- | src/pack-objects.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c index 7ce1b6cb3..335944c0c 100644 --- a/src/pack-objects.c +++ b/src/pack-objects.c @@ -332,8 +332,10 @@ static int write_object(git_buf *buf, git_packbuilder *pb, git_pobject *po) git_hash_update(&pb->ctx, data, size) < 0) goto on_error; - if (po->delta_data) + if (po->delta_data) { git__free(po->delta_data); + po->delta_data = NULL; + } git_odb_object_free(obj); git_buf_free(&zbuf); @@ -612,6 +614,15 @@ static int write_pack(git_packbuilder *pb, error = cb(entry_oid.id, GIT_OID_RAWSZ, data); done: + /* if callback cancelled writing, we must still free delta_data */ + for ( ; i < pb->nr_objects; ++i) { + po = write_order[i]; + if (po->delta_data) { + git__free(po->delta_data); + po->delta_data = NULL; + } + } + git__free(write_order); git_buf_free(&buf); return error; |