diff options
author | XTao <xutao881001@gmail.com> | 2014-01-26 17:07:39 +0800 |
---|---|---|
committer | XTao <xutao881001@gmail.com> | 2014-01-26 22:26:53 +0800 |
commit | 1cb5a8119445bb62c6868eb61649b9b901c855cb (patch) | |
tree | b14c075bd725c4204b9e051575c2f27dd8c7c7cc /src/pack-objects.c | |
parent | ca55fc6356a5edd838ca03b82f3601bd94e8d750 (diff) | |
download | libgit2-1cb5a8119445bb62c6868eb61649b9b901c855cb.tar.gz |
Fix write_object.
Diffstat (limited to 'src/pack-objects.c')
-rw-r--r-- | src/pack-objects.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c index c4ed4dce3..1774b07dc 100644 --- a/src/pack-objects.c +++ b/src/pack-objects.c @@ -288,6 +288,7 @@ static int write_object( git_odb_object *obj = NULL; git_otype type; unsigned char hdr[10], *zbuf = NULL; + void *delta_data = NULL; void *data; size_t hdr_len, zbuf_len = COMPRESS_BUFLEN, data_len; ssize_t written; @@ -295,10 +296,11 @@ static int write_object( if (po->delta) { if (po->delta_data) - data = po->delta_data; - else if ((error = get_delta(&data, pb->odb, po)) < 0) + delta_data = po->delta_data; + else if ((error = get_delta(&delta_data, pb->odb, po)) < 0) goto done; + data = delta_data; data_len = po->delta_size; type = GIT_OBJ_REF_DELTA; } else { @@ -351,7 +353,7 @@ static int write_object( } if (po->delta) - git__free(data); + git__free(delta_data); } if (po->delta_data) { |