diff options
author | Nicolas Pitre <nico@cam.org> | 2008-10-29 19:02:52 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-11-02 15:22:35 -0800 |
commit | 59dd9ed18398d96922e345f7987f1245870fb3e5 (patch) | |
tree | 95ab84405d1251fbc16594daa16582edc3472872 /builtin-pack-objects.c | |
parent | 538cf6b6e5f663eea9b777ef12ae58eb0c919480 (diff) | |
download | git-59dd9ed18398d96922e345f7987f1245870fb3e5.tar.gz |
pack-objects: don't leak pack window reference when splitting packs
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r-- | builtin-pack-objects.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 5be6664c72..1b6eff314e 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -389,22 +389,28 @@ static unsigned long write_object(struct sha1file *f, dheader[pos] = ofs & 127; while (ofs >>= 7) dheader[--pos] = 128 | (--ofs & 127); - if (limit && hdrlen + sizeof(dheader) - pos + datalen + 20 >= limit) + if (limit && hdrlen + sizeof(dheader) - pos + datalen + 20 >= limit) { + unuse_pack(&w_curs); return 0; + } sha1write(f, header, hdrlen); sha1write(f, dheader + pos, sizeof(dheader) - pos); hdrlen += sizeof(dheader) - pos; reused_delta++; } else if (type == OBJ_REF_DELTA) { - if (limit && hdrlen + 20 + datalen + 20 >= limit) + if (limit && hdrlen + 20 + datalen + 20 >= limit) { + unuse_pack(&w_curs); return 0; + } sha1write(f, header, hdrlen); sha1write(f, entry->delta->idx.sha1, 20); hdrlen += 20; reused_delta++; } else { - if (limit && hdrlen + datalen + 20 >= limit) + if (limit && hdrlen + datalen + 20 >= limit) { + unuse_pack(&w_curs); return 0; + } sha1write(f, header, hdrlen); } copy_pack_data(f, p, &w_curs, offset, datalen); |