diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index e0ce114be7f65307da96bc620d5fb8902b793c73..d3efeff03f89cc0f4d0da463ddf878c28effb31e 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
/* nothing */;
deflateEnd(&stream);
datalen = stream.total_out;
- deflateEnd(&stream);
+
/*
* The object header is a byte of 'type' followed by zero or
* more bytes of length.
p[i].data_ready = 0;
/* try to split chunks on "path" boundaries */
- while (sub_size < list_size && list[sub_size]->hash &&
+ while (sub_size && sub_size < list_size &&
+ list[sub_size]->hash &&
list[sub_size]->hash == list[sub_size-1]->hash)
sub_size++;
while (fgets(line, sizeof(line), stdin) != NULL) {
int len = strlen(line);
- if (line[len - 1] == '\n')
+ if (len && line[len - 1] == '\n')
line[--len] = 0;
if (!len)
break;