From: malc <av1474@comtv.ru>
To: Jay Foad <jay.foad@gmail.com>
Cc: Richard Henderson <rth@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] linux-user: Protect against allocation failure in load_symbols.
Date: Fri, 30 Jul 2010 17:42:26 +0400 (MSD) [thread overview]
Message-ID: <alpine.LNX.2.00.1007301738480.1510@linmac> (raw)
In-Reply-To: <AANLkTimRCbZN-RXBsrc6vLcWsDvuReUJ+kp51b4UnB=J@mail.gmail.com>
On Fri, 30 Jul 2010, Jay Foad wrote:
> > + /* Attempt to free the storage associated with the local symbols
> > + that we threw away. Whether or not this has any effect on the
> > + memory allocation depends on the malloc implementation and how
> > + many symbols we managed to discard. */
> > syms = realloc(syms, nsyms * sizeof(*syms));
> > + if (syms == NULL) {
> > + free(s);
> > + free(strings);
> > + return;
> > + }
>
> If realloc() fails it leaves the original object unchanged, so can't
> you just write:
Life is not as simple as one would like it to be.
http://www.mail-archive.com/qemu-devel@nongnu.org/msg22137.html
>
> t = realloc(syms, nsyms * sizeof(*syms));
> if (t != NULL) {
> syms = t;
> }
>
> ?
>
> Jay.
>
--
mailto:av1474@comtv.ru
next prev parent reply other threads:[~2010-07-30 13:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-30 13:04 [Qemu-devel] [PATCH] linux-user: Protect against allocation failure in load_symbols Jay Foad
2010-07-30 13:42 ` malc [this message]
-- strict thread matches above, loose matches on Subject: below --
2010-07-29 16:37 Richard Henderson
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=alpine.LNX.2.00.1007301738480.1510@linmac \
--to=av1474@comtv.ru \
--cc=jay.foad@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@redhat.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).