Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

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

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:41:59

Possibly related (same subject, not in this thread)


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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help