Code

http.c: avoid freeing an uninitialized pointer
authorJunio C Hamano <gitster@pobox.com>
Mon, 14 Sep 2009 21:48:15 +0000 (14:48 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 Sep 2009 21:48:15 +0000 (14:48 -0700)
An earlier 59b8d38 (http.c: remove verification of remote packs) left
the variable "url" uninitialized; "goto cleanup" codepath can free it
which is not very nice.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c

diff --git a/http.c b/http.c
index d0cc1b3340cdbdd7f9aa57beb6eea548953ec8c6..15926d8d6d17d1cbdf7f03c457e8ff983270f363 100644 (file)
--- a/http.c
+++ b/http.c
@@ -866,7 +866,7 @@ static int fetch_pack_index(unsigned char *sha1, const char *base_url)
        int ret = 0;
        char *hex = xstrdup(sha1_to_hex(sha1));
        char *filename;
-       char *url;
+       char *url = NULL;
        struct strbuf buf = STRBUF_INIT;
 
        if (has_pack_index(sha1)) {