qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: Riku Voipio <riku.voipio@iki.fi>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] linux-user: Fix possible realloc memory leak
Date: Tue, 18 Jan 2011 18:02:58 +0000	[thread overview]
Message-ID: <AANLkTimWBfiKhk6AtM+adaJkrrCa7wCLZWgpn0yHFBeX@mail.gmail.com> (raw)
In-Reply-To: <m3wrm22j97.fsf@blackfin.pond.sub.org>

On 18 January 2011 17:51, Markus Armbruster <armbru@redhat.com> wrote:
> Stefan Weil <weil@mail.berlios.de> writes:
>> Am 18.01.2011 09:26, schrieb Markus Armbruster:
>>> Stefan Weil <weil@mail.berlios.de> writes:
>>>> Extract from "man realloc":
>>>> "If realloc() fails the original block is left untouched;
>>>> it is not freed or moved."

>>> Sidestep the problem via qemu_realloc() instead?
>>
>> The same change was applied to bsd-user/elfload.c.
>>
>> As symbol loading is not essential in most applications,
>> returning after out-of-memory should be better than
>> aborting (that's what qemu_realloc does).
>
> Unless the requested size is *really* large, I'd expect this to stave
> off the out-of-memory failure for a few microseconds at best.

Yeah, but the patch is OK, it fixes an actual bug and
it does so in line with the malloc-failure handling of
the rest of the function. It doesn't seem to me to
be important enough an issue to worry about one way
or the other.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

      parent reply	other threads:[~2011-01-18 18:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17 20:36 [Qemu-devel] [PATCH] linux-user: Fix possible realloc memory leak Stefan Weil
2011-01-18  8:26 ` Markus Armbruster
2011-01-18 17:09   ` Stefan Weil
2011-01-18 17:51     ` Markus Armbruster
2011-01-18 17:59       ` Stefan Weil
2011-01-18 18:02       ` Peter Maydell [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=AANLkTimWBfiKhk6AtM+adaJkrrCa7wCLZWgpn0yHFBeX@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).