read-cache: use of memory after it is freed
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Sat, 20 Oct 2018 07:33:34 +0000 (00:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Oct 2018 03:37:14 +0000 (12:37 +0900)
introduced with c46c406ae1e (trace.h: support nested performance tracing)
on Aug 18, 2018 but not affecting maint

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
read-cache.c

index 41f313b..66fc535 100644 (file)
@@ -2038,8 +2038,8 @@ int read_index_from(struct index_state *istate, const char *path,
        freshen_shared_index(base_path, 0);
        merge_base_index(istate);
        post_read_index_from(istate);
-       free(base_path);
        trace_performance_leave("read cache %s", base_path);
+       free(base_path);
        return ret;
 }