object: fix leak of shallow_stat

In eee4502baaf ("shallow: migrate shallow information into the object parser", 2018-05-17), we added a stat_validity pointer into the parsed_object_pool struct, but did not add code to free this in parsed_object_pool_clear(). This leak was found by fuzz-commit-graph. Clear the struct and then free it in parsed_object_pool_clear() to prevent the leak. Signed-off-by: Josh Steadmon <steadmon@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Josh Steadmon committed Feb 7, 2019 at 12:05 UTC 96b0710ee405bbdea404641c82eabf28fe629b7a
1 file changed +2
object.c
+2
@@ -557,9 +557,11 @@ void parsed_object_pool_clear(struct parsed_object_pool *o)
557 clear_alloc_state(o->commit_state);
558 clear_alloc_state(o->tag_state);
559 clear_alloc_state(o->object_state);
560 + stat_validity_clear(o->shallow_stat);
561 FREE_AND_NULL(o->blob_state);
562 FREE_AND_NULL(o->tree_state);
563 FREE_AND_NULL(o->commit_state);
564 FREE_AND_NULL(o->tag_state);
565 FREE_AND_NULL(o->object_state);
566 + FREE_AND_NULL(o->shallow_stat);
567 }