Code

http.c: Remove bad free of static block
authorShawn O. Pearce <spearce@spearce.org>
Sat, 17 Apr 2010 20:07:34 +0000 (13:07 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 17 Apr 2010 20:55:45 +0000 (13:55 -0700)
The filename variable here is pointing to a block of memory that
was allocated by sha1_file.c and is also held in a static variable
scoped within the sha1_pack_name() function.  Doing a free() here is
returning that memory to the allocator while we might still try to
reuse it on a subsequent sha1_pack_name() invocation.  That's not
acceptable, so don't free it.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http.c

diff --git a/http.c b/http.c
index deab59551dad9a0d2c2e86d75071fa561e4cbf1a..9526491a45357d5d80068bac939a4aa7cce9aa91 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1082,7 +1082,6 @@ struct http_pack_request *new_http_pack_request(
        return preq;
 
 abort:
-       free(filename);
        free(preq->url);
        free(preq);
        return NULL;