[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] linux-user: Fix possible realloc memory leak
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH] linux-user: Fix possible realloc memory leak |
Date: |
Tue, 18 Jan 2011 18:02:58 +0000 |
On 18 January 2011 17:51, Markus Armbruster <address@hidden> wrote:
> Stefan Weil <address@hidden> writes:
>> Am 18.01.2011 09:26, schrieb Markus Armbruster:
>>> Stefan Weil <address@hidden> 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 <address@hidden>
-- PMM