aboutsummaryrefslogtreecommitdiffstats
path: root/object-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'object-file.c')
-rw-r--r--object-file.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/object-file.c b/object-file.c
index 9f6e8504fb..e463b4bad3 100644
--- a/object-file.c
+++ b/object-file.c
@@ -1348,16 +1348,16 @@ static void *unpack_loose_rest(git_zstream *stream,
}
}
- if (status != Z_STREAM_END)
+ if (status != Z_STREAM_END) {
error(_("corrupt loose object '%s'"), oid_to_hex(oid));
- else if (stream->avail_in)
+ FREE_AND_NULL(buf);
+ } else if (stream->avail_in) {
error(_("garbage at end of loose object '%s'"),
oid_to_hex(oid));
- else
- return buf;
+ FREE_AND_NULL(buf);
+ }
- free(buf);
- return NULL;
+ return buf;
}
/*