This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: avoiding realloc leaks: p = realloc (p, ...
- From: Jim Meyering <jim at meyering dot net>
- To: libc-alpha at gnu dot org
- Date: Tue, 20 Apr 2004 15:24:31 +0200
- Subject: Re: avoiding realloc leaks: p = realloc (p, ...
- References: <85n056bxud.fsf@pi.meyering.net>
I wrote the following, but it triggered a bounce because
of something in the body of the original message. So I'm resending,
but without all of the output from the command below, hoping this
will appease the small gods...
I've also just sent a message to the global-allow-... address, as
the bounce notification suggested.
> libc contains some uses of realloc that have this form
>
> p = realloc (p, ...
>
> so when realloc fails, that probably leaks whatever p was pointing to.
> Here are some that are easily identified -- not including the one in
> misc/error.c for which I just submitted a patch.
> Of course, to find those where the search string is not all on one line,
> you'd have to do more work.
> [obviously, the ones in xmalloc. and tst-*.c don't matter as much]
>
> $ grep -Rw realloc .|grep -E '\b([^ ]+) = realloc \(\1,'