Re: [PATCH] Find size of SHA1 object without inflating everything.

From: Linus Torvalds <torvalds@osdl.org>
Date: 2005-06-03 08:10:11
On Thu, 2 Jun 2005, Junio C Hamano wrote:
>  
> +int sha1_file_size(const unsigned char *sha1, unsigned long *sizep)
...
> +	ret = unpack_sha1_header(&stream, map, mapsize, hdr, sizeof(hdr));
...
> +	delta_data_head = unpack_sha1_rest(&stream, hdr, 200);

Why do you do this? You've already unpacked 1024 bytes (including the
header), now you want to unpack at least 200 bytes past the header (which
is less than what you already did.

So here "unpack_sha1_rest()" just ends up being a "xmalloc + memcpy", but 
since you don't actually want the malloc (indeed, you're leaking it, as 
far as I can tell), it seems to be all bad..

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Jun 03 08:09:57 2005

This archive was generated by hypermail 2.1.8 : 2005-06-03 08:09:57 EST