From 8616a2d0cb57865540f1c00ac2e5385a6cc5d84e Mon Sep 17 00:00:00 2001 From: Jameson Miller Date: Mon, 2 Jul 2018 19:49:39 +0000 Subject: block alloc: add validations around cache_entry lifecyle Add an option (controlled by an environment variable) perform extra validations on mem_pool allocated cache entries. When set: 1) Invalidate cache_entry memory when discarding cache_entry. 2) When discarding index_state struct, verify that all cache_entries were allocated from expected mem_pool. 3) When discarding mem_pools, invalidate mem_pool memory. This should provide extra checks that mem_pools and their allocated cache_entries are being used as expected. Signed-off-by: Jameson Miller Signed-off-by: Junio C Hamano --- git.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'git.c') diff --git a/git.c b/git.c index c2f48d53dd..010898ba6d 100644 --- a/git.c +++ b/git.c @@ -414,7 +414,10 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) trace_argv_printf(argv, "trace: built-in: git"); + validate_cache_entries(&the_index); status = p->fn(argc, argv, prefix); + validate_cache_entries(&the_index); + if (status) return status; -- cgit v1.2.3