From: Shawn O. Pearce Date: Mon, 3 Mar 2008 02:35:10 +0000 (-0500) Subject: Free the path_lists used to find non-local tags in git-fetch X-Git-Tag: v1.5.5-rc0~44^2~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=49d58fd0770cbb667a0d7532156ced803e482864;p=git.git Free the path_lists used to find non-local tags in git-fetch To support calling find_non_local_tags() more than once in a single git-fetch process we need the existing_refs to be stack-allocated so it resets on the second call. We also should free the path lists to avoid unnecessary memory leaking. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- diff --git a/builtin-fetch.c b/builtin-fetch.c index 1d3ce775a..3758d4817 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -457,7 +457,7 @@ static void find_non_local_tags(struct transport *transport, struct ref **head, struct ref ***tail) { - static struct path_list existing_refs = { NULL, 0, 0, 0 }; + struct path_list existing_refs = { NULL, 0, 0, 0 }; struct path_list new_refs = { NULL, 0, 0, 1 }; char *ref_name; int ref_name_len; @@ -503,6 +503,8 @@ static void find_non_local_tags(struct transport *transport, } free(ref_name); } + path_list_clear(&existing_refs, 0); + path_list_clear(&new_refs, 0); } static int do_fetch(struct transport *transport,