1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-04 22:56:34 +02:00
git/fuzz-commit-graph.c
Josh Steadmon 104de88675 fuzz-commit-graph: properly free graph struct
Use the provided free_commit_graph() to properly free the commit graph
in fuzz-commit-graph. Otherwise, the fuzzer itself leaks memory when the
struct contains pointers to allocated memory.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-06-08 10:02:29 -07:00

19 lines
422 B
C

#include "commit-graph.h"
#include "repository.h"
struct commit_graph *parse_commit_graph(void *graph_map, size_t graph_size);
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
struct commit_graph *g;
initialize_the_repository();
g = parse_commit_graph((void *)data, size);
repo_clear(the_repository);
free_commit_graph(g);
return 0;
}