diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-10-27 11:42:57 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-27 11:42:57 -0700 |
commit | ea4f9685cb432caf357ad8af56a91877b6d04663 (patch) | |
tree | 4171553d03d95eadbe6f2323f9870d29f133bd51 /sha1_file.c | |
parent | 9c6bebd14233af291ffb8dde2975b06c76e9ce5f (diff) | |
download | git-ea4f9685cb432caf357ad8af56a91877b6d04663.tar.gz |
unpack_object_header_buffer(): clear the size field upon errornd/misc-cleanups
The callers do not use the returned size when the function says
it did not use any bytes and sets the type to OBJ_BAD, so this
should not matter in practice, but it is a good code hygiene
anyway.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c index 27f3b9b278..833f5b9b58 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -1267,7 +1267,8 @@ unsigned long unpack_object_header_buffer(const unsigned char *buf, while (c & 0x80) { if (len <= used || bitsizeof(long) <= shift) { error("bad object header"); - return 0; + size = used = 0; + break; } c = buf[used++]; size += (c & 0x7f) << shift; |