http*: copy string returned by sha1_to_hex
commit20cfb3aa710d302829a776d7fbad2b89f71f15b6
authorTay Ray Chuan <rctay89@gmail.com>
Sat, 6 Jun 2009 08:43:36 +0000 (6 16:43 +0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 6 Jun 2009 17:56:27 +0000 (6 10:56 -0700)
treeb9e4153f98f61b91f7b2b3f86611bdc2fdaa63df
parent48188c259a7e6c87c20121933287b8c8ca721e3a
http*: copy string returned by sha1_to_hex

In the fetch_index implementations in http-push.c and http-walker.c,
the string returned by sha1_to_hex is assumed to stay immutable.

This patch ensures that hex stays immutable by copying the string
returned by sha1_to_hex (via xstrdup) and frees it subsequently. It
also refactors free()'s and fclose()'s with labels.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c
http-walker.c