http.c: Remove unnecessary strdup of sha1_to_hex result
[gitweb.git] / http.c
diff --git a/http.c b/http.c
index 7ee1ba5a0007042f6e89594d3f4cb7b268663c90..95e3b8bec87ea5caba7d0b293eb7c34184c86f7a 100644 (file)
--- a/http.c
+++ b/http.c
@@ -899,7 +899,6 @@ int http_fetch_ref(const char *base, struct ref *ref)
 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 = NULL;
        struct strbuf buf = STRBUF_INIT;
@@ -910,10 +909,10 @@ static int fetch_pack_index(unsigned char *sha1, const char *base_url)
        }
 
        if (http_is_verbose)
-               fprintf(stderr, "Getting index for pack %s\n", hex);
+               fprintf(stderr, "Getting index for pack %s\n", sha1_to_hex(sha1));
 
        end_url_with_slash(&buf, base_url);
-       strbuf_addf(&buf, "objects/pack/pack-%s.idx", hex);
+       strbuf_addf(&buf, "objects/pack/pack-%s.idx", sha1_to_hex(sha1));
        url = strbuf_detach(&buf, NULL);
 
        filename = sha1_pack_index_name(sha1);
@@ -921,7 +920,6 @@ static int fetch_pack_index(unsigned char *sha1, const char *base_url)
                ret = error("Unable to get pack index %s\n", url);
 
 cleanup:
-       free(hex);
        free(url);
        return ret;
 }