{"thread":{"id":"9769","subject":"[PATCH] fix memleak from tree pathspec in git-blame","startedAt":"2007-09-04T06:54:19Z","lastAt":"2007-09-04T06:54:19Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"52406","messageId":"7vir6q7wf8.fsf@gitster.siamese.dyndns.org","threadId":"9769","inReplyTo":null,"subject":"[PATCH] fix memleak from tree pathspec in git-blame","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-09-04T06:54:19Z","receivedAt":"2007-09-04T06:54:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"We repeatedly run diff-tree while finding code movements.  The\npathspec data is changed into a list of paths and their lengths\nfor quicker access by diff_tree_setup_paths(), and you need to\nrelease the extra memory when you are done using that pathspec\ndata.\n\nNot releasing it is not a problem for \"git log -- path\" (or its\nplumbing equivalent \"git rev-list -- paths\"), because the\npathspec never changes during the traversal, but it was\nnoticeable for blame especially with -C -C.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n\n builtin-blame.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-blame.c b/builtin-blame.c\nindex dc88a95..aace08c 100644\n--- a/builtin-blame.c\n+++ b/builtin-blame.c\n@@ -380,6 +380,7 @@ static struct origin *find_origin(struct scoreboard *sb,\n \t\t}\n \t}\n \tdiff_flush(&diff_opts);\n+\tdiff_tree_release_paths(&diff_opts);\n \tif (porigin) {\n \t\t/*\n \t\t * Create a freestanding copy that is not part of\n@@ -436,6 +437,7 @@ static struct origin *find_rename(struct scoreboard *sb,\n \t\t}\n \t}\n \tdiff_flush(&diff_opts);\n+\tdiff_tree_release_paths(&diff_opts);\n \treturn porigin;\n }\n \n@@ -1157,6 +1159,7 @@ static int find_copy_in_parent(struct scoreboard *sb,\n \t\t}\n \t}\n \tdiff_flush(&diff_opts);\n+\tdiff_tree_release_paths(&diff_opts);\n \n \treturn retval;\n }\n"}]}