{"thread":{"id":"12446","subject":"[PATCH v3 5/8] Free the path_lists used to find non-local tags in git-fetch","startedAt":"2008-03-03T02:35:10Z","lastAt":"2008-03-03T02:35:10Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":3,"patchTotal":8},"messages":[{"id":"70731","messageId":"20080303023510.GE9966@spearce.org","threadId":"12446","inReplyTo":null,"subject":"[PATCH v3 5/8] Free the path_lists used to find non-local tags in git-fetch","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-03-03T02:35:10Z","receivedAt":"2008-03-03T02:35:10Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"To support calling find_non_local_tags() more than once in a single\ngit-fetch process we need the existing_refs to be stack-allocated\nso it resets on the second call.  We also should free the path\nlists to avoid unnecessary memory leaking.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n builtin-fetch.c |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-fetch.c b/builtin-fetch.c\nindex 1d3ce77..3758d48 100644\n--- a/builtin-fetch.c\n+++ b/builtin-fetch.c\n@@ -457,7 +457,7 @@ static void find_non_local_tags(struct transport *transport,\n \t\t\tstruct ref **head,\n \t\t\tstruct ref ***tail)\n {\n-\tstatic struct path_list existing_refs = { NULL, 0, 0, 0 };\n+\tstruct path_list existing_refs = { NULL, 0, 0, 0 };\n \tstruct path_list new_refs = { NULL, 0, 0, 1 };\n \tchar *ref_name;\n \tint ref_name_len;\n@@ -503,6 +503,8 @@ static void find_non_local_tags(struct transport *transport,\n \t\t}\n \t\tfree(ref_name);\n \t}\n+\tpath_list_clear(&existing_refs, 0);\n+\tpath_list_clear(&new_refs, 0);\n }\n \n static int do_fetch(struct transport *transport,\n-- \n1.5.4.3.468.g36990\n\n"}]}