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
This commit is contained in:
Junio C Hamano
2021-11-12 15:29:25 -08:00
3 changed files with 12 additions and 4 deletions

View File

@ -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 */
}