summaryrefslogtreecommitdiff
path: root/builtin/fsck.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-11-12 23:29:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-11-12 23:29:25 (GMT)
commit2c0fa66bc81a0725cd65fda69640552361536e50 (patch)
treef93b70f2b4e240265c1660a3140c31b803a017fc /builtin/fsck.c
parent8996d68ac7052bf96a38a2b36546c4239280279e (diff)
parent16235e3b1460ddd708995b4cc5028e49d47e3761 (diff)
downloadgit-2c0fa66bc81a0725cd65fda69640552361536e50.zip
git-2c0fa66bc81a0725cd65fda69640552361536e50.tar.gz
git-2c0fa66bc81a0725cd65fda69640552361536e50.tar.bz2
Merge branch 'ab/fsck-unexpected-type'
Regression fix. * ab/fsck-unexpected-type: object-file: free(*contents) only in read_loose_object() caller object-file: fix SEGV on free() regression in v2.34.0-rc2
Diffstat (limited to 'builtin/fsck.c')
-rw-r--r--builtin/fsck.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/fsck.c b/builtin/fsck.c
index d87c28a..27b9e78 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -605,7 +605,7 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
struct object *obj;
enum object_type type = OBJ_NONE;
unsigned long size;
- void *contents;
+ void *contents = NULL;
int eaten;
struct object_info oi = OBJECT_INFO_INIT;
struct object_id real_oid = *null_oid();
@@ -630,6 +630,7 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
path);
if (err < 0) {
errors_found |= ERROR_OBJECT;
+ free(contents);
return 0; /* keep checking other objects */
}