{"thread":{"id":"49623","subject":"[PATCH] read-cache: use of memory after it is freed","startedAt":"2018-10-20T07:39:38Z","lastAt":"2018-10-22T03:39:27Z","messageCount":3,"participants":["Carlo Marcelo Arenas Belón","Duy Nguyen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"361000","messageId":"20181020073334.48348-1-carenas@gmail.com","threadId":"49623","inReplyTo":null,"subject":"[PATCH] read-cache: use of memory after it is freed","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2018-10-20T07:33:34Z","receivedAt":"2018-10-20T07:39:38Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"introduced with c46c406ae1e (trace.h: support nested performance tracing)\non Aug 18, 2018 but not affecting maint\n\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n---\n read-cache.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/read-cache.c b/read-cache.c\nindex 1df5c16dbc..78f47d2f50 100644\n--- a/read-cache.c\n+++ b/read-cache.c\n@@ -2297,8 +2297,8 @@ int read_index_from(struct index_state *istate, const char *path,\n \tfreshen_shared_index(base_path, 0);\n \tmerge_base_index(istate);\n \tpost_read_index_from(istate);\n-\tfree(base_path);\n \ttrace_performance_leave(\"read cache %s\", base_path);\n+\tfree(base_path);\n \treturn ret;\n }\n \n-- \n2.19.1\n\n"},{"id":"361064","messageId":"CACsJy8B8q84=AqMvAkc5=oSPBbwMQkdQhRe=RYVKGYmnsGxVGA@mail.gmail.com","threadId":"49623","inReplyTo":"20181020073334.48348-1-carenas@gmail.com","subject":"Re: [PATCH] read-cache: use of memory after it is freed","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2018-10-20T15:15:01Z","receivedAt":"2018-10-20T15:15:34Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Oct 20, 2018 at 9:33 AM Carlo Marcelo Arenas Belón\n<carenas@gmail.com> wrote:\n>\n> introduced with c46c406ae1e (trace.h: support nested performance tracing)\n> on Aug 18, 2018 but not affecting maint\n>\n> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n> ---\n>  read-cache.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/read-cache.c b/read-cache.c\n> index 1df5c16dbc..78f47d2f50 100644\n> --- a/read-cache.c\n> +++ b/read-cache.c\n> @@ -2297,8 +2297,8 @@ int read_index_from(struct index_state *istate, const char *path,\n>         freshen_shared_index(base_path, 0);\n>         merge_base_index(istate);\n>         post_read_index_from(istate);\n> -       free(base_path);\n>         trace_performance_leave(\"read cache %s\", base_path);\n> +       free(base_path);\n\nOops. Ack.\n\n>         return ret;\n>  }\n>\n> --\n> 2.19.1\n>\n\n\n-- \nDuy\n"},{"id":"361129","messageId":"xmqqva5uwsyd.fsf@gitster-ct.c.googlers.com","threadId":"49623","inReplyTo":"CACsJy8B8q84=AqMvAkc5=oSPBbwMQkdQhRe=RYVKGYmnsGxVGA@mail.gmail.com","subject":"Re: [PATCH] read-cache: use of memory after it is freed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-10-22T03:39:22Z","receivedAt":"2018-10-22T03:39:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n>>         freshen_shared_index(base_path, 0);\n>>         merge_base_index(istate);\n>>         post_read_index_from(istate);\n>> -       free(base_path);\n>>         trace_performance_leave(\"read cache %s\", base_path);\n>> +       free(base_path);\n>\n> Oops. Ack.\n\nThanks, both.\n\n>> introduced with c46c406ae1e (trace.h: support nested performance tracing)\n>> on Aug 18, 2018 but not affecting maint\n\nYup.  The series nd/unpack-trees-with-cache-tree however was\ndesigned to be merge-able down to 'maint', so it is a good idea to\nfix this at the tip of the topic.  So I'll queue it on top of\n5f4436a7 (\"Document update for nd/unpack-trees-with-cache-tree\",\n2018-08-25).\n"}]}