From: Jay Foad <jay.foad@gmail.com>
To: Richard Henderson <rth@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] linux-user: Protect against allocation failure in load_symbols.
Date: Fri, 30 Jul 2010 14:04:38 +0100 [thread overview]
Message-ID: <AANLkTimRCbZN-RXBsrc6vLcWsDvuReUJ+kp51b4UnB=J@mail.gmail.com> (raw)
> + /* 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:
t = realloc(syms, nsyms * sizeof(*syms));
if (t != NULL) {
syms = t;
}
?
Jay.
next reply other threads:[~2010-07-30 13:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-30 13:04 Jay Foad [this message]
2010-07-30 13:42 ` [Qemu-devel] [PATCH] linux-user: Protect against allocation failure in load_symbols malc
-- 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='AANLkTimRCbZN-RXBsrc6vLcWsDvuReUJ+kp51b4UnB=J@mail.gmail.com' \
--to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.