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 <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Shawn O. Pearce committed
Mar 2, 2008 at 21:35 UTC
49d58fd0770cbb667a0d7532156ced803e482864
1 file changed
+3
-1
builtin-fetch.c
+3
-1
@@ -457,7 +457,7 @@ static void find_non_local_tags(struct transport *transport,
457
struct ref **head,
458
struct ref ***tail)
459
{
460
- static struct path_list existing_refs = { NULL, 0, 0, 0 };
460
+ struct path_list existing_refs = { NULL, 0, 0, 0 };
461
struct path_list new_refs = { NULL, 0, 0, 1 };
462
char *ref_name;
463
int ref_name_len;
@@ -503,6 +503,8 @@ static void find_non_local_tags(struct transport *transport,
503
}
504
free(ref_name);
505
}
506
+ path_list_clear(&existing_refs, 0);
507
+ path_list_clear(&new_refs, 0);
508
}
509
510
static int do_fetch(struct transport *transport,