From: Eric Wong <normalperson@yhbt.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: Re: [PATCH] Avoid allocating 0 bytes, was Re: [PATCH 4/4] git-compat-util.h: dietlibc-friendly x{malloc,realloc,calloc}
Date: Fri, 30 Dec 2005 15:00:35 -0800 [thread overview]
Message-ID: <20051230230035.GA7165@mail.yhbt.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0512261916440.8435@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> diff --git a/index-pack.c b/index-pack.c
> index d4ce3af..2927632 100644
> --- a/index-pack.c
> +++ b/index-pack.c
> @@ -103,7 +103,7 @@ static void *unpack_entry_data(unsigned
> unsigned long pack_limit = pack_size - 20;
> unsigned long pos = *current_pos;
> z_stream stream;
> - void *buf = xmalloc(size);
> + void *buf = xmalloc(size ? size : 1);
>
> memset(&stream, 0, sizeof(stream));
> stream.next_out = buf;
This is the only one I've managed to hit upon further use the past week
of usage. No way to break out of the function, either, because
current_pos needs to be updated (and it is changed despite a zero-byte
blob object being in my repository).
--
Eric Wong
prev parent reply other threads:[~2005-12-30 23:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-24 12:10 [PATCH 0/4] dietlibc compatibility Eric Wong
2005-12-24 12:11 ` [PATCH 1/4] git.c: extra #include for dietlibc (and possibly other C libraries) Eric Wong
2005-12-26 17:01 ` Junio C Hamano
2005-12-24 12:12 ` [PATCH 2/4] short circuit out of a few places where we would allocate zero bytes Eric Wong
2005-12-24 12:44 ` Johannes Schindelin
2005-12-28 4:22 ` H. Peter Anvin
2005-12-28 4:38 ` Linus Torvalds
2005-12-28 5:07 ` Junio C Hamano
2005-12-28 16:58 ` H. Peter Anvin
2005-12-24 12:13 ` [PATCH 3/4] add xmktime() function that always accounts for the TZ env Eric Wong
2005-12-24 12:45 ` Johannes Schindelin
2005-12-24 19:18 ` Junio C Hamano
2005-12-24 19:52 ` Eric Wong
2005-12-24 21:10 ` Junio C Hamano
2005-12-24 12:14 ` [PATCH 4/4] git-compat-util.h: dietlibc-friendly x{malloc,realloc,calloc} Eric Wong
2005-12-24 18:28 ` Junio C Hamano
2005-12-24 21:15 ` Eric Wong
2005-12-26 18:16 ` [PATCH] Avoid allocating 0 bytes, was " Johannes Schindelin
2005-12-26 19:10 ` Junio C Hamano
2005-12-26 20:34 ` Johannes Schindelin
2005-12-26 22:03 ` [PATCH] avoid asking ?alloc() for zero bytes Junio C Hamano
2005-12-26 22:18 ` Johannes Schindelin
2005-12-28 20:38 ` [PATCH] Avoid allocating 0 bytes, was Re: [PATCH 4/4] git-compat-util.h: dietlibc-friendly x{malloc,realloc,calloc} Johannes Schindelin
2005-12-30 23:00 ` Eric Wong [this message]
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=20051230230035.GA7165@mail.yhbt.net \
--to=normalperson@yhbt.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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).