From: Nicolas Pitre <nico@cam.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH 9/9] pack-objects: don't leak pack window reference when splitting packs
Date: Wed, 29 Oct 2008 19:02:52 -0400 [thread overview]
Message-ID: <1225321372-6570-10-git-send-email-nico@cam.org> (raw)
In-Reply-To: <1225321372-6570-9-git-send-email-nico@cam.org>
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
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 826c762..c93d69a 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);
--
1.6.0.3.757.g01be.dirty
next prev parent reply other threads:[~2008-10-29 23:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-29 23:02 [PATCH 0/9] more robustness against pack corruptions Nicolas Pitre
2008-10-29 23:02 ` [PATCH 1/9] close another possibility for propagating pack corruption Nicolas Pitre
2008-10-29 23:02 ` [PATCH 2/9] better validation on delta base object offsets Nicolas Pitre
2008-10-29 23:02 ` [PATCH 3/9] make unpack_object_header() non fatal Nicolas Pitre
2008-10-29 23:02 ` [PATCH 4/9] make packed_object_info() resilient to pack corruptions Nicolas Pitre
2008-10-29 23:02 ` [PATCH 5/9] make check_object() " Nicolas Pitre
2008-10-29 23:02 ` [PATCH 6/9] make find_pack_revindex() aware of the nasty world Nicolas Pitre
2008-10-29 23:02 ` [PATCH 7/9] pack-objects: allow "fixing" a corrupted pack without a full repack Nicolas Pitre
2008-10-29 23:02 ` [PATCH 8/9] extend test coverage for latest pack corruption resilience improvements Nicolas Pitre
2008-10-29 23:02 ` Nicolas Pitre [this message]
2008-10-31 8:46 ` [PATCH 1/9] close another possibility for propagating pack corruption Junio C Hamano
2008-10-31 15:31 ` Nicolas Pitre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1225321372-6570-10-git-send-email-nico@cam.org \
--to=nico@cam.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).