qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Changed malloc() to g_malloc() at places where


From: haris iqbal
Subject: Re: [Qemu-devel] [PATCH] Changed malloc() to g_malloc() at places where return value was not being checked
Date: Tue, 22 Mar 2016 22:20:02 +0530

On Tue, Mar 22, 2016 at 10:16 PM, Peter Maydell
<address@hidden> wrote:
> On 22 March 2016 at 16:15, haris iqbal <address@hidden> wrote:
>> One more question. About tracking down g_free(). I thought of
>> submitting for linux-user/qemu.h first. As it is done in a function
>> called lock_user(), which is called by many other functions (around
>> 144, too many to be checked manually). The interesting part is, the
>> free is done by a pair function called unlock_user(). I just want to
>> ask if all those lock_user() calls has a matching unlock_user() call
>> to free() the malloc(), or there is a hidden free somewhere else also?
>> This would save a lot of time. Thanks.
>
> lock_user and unlock_user should always match. (In particular
> lock_user will only malloc if DEBUG_REMAP is defined, which it
> is not by default, so callers can't be free()ing by mistake.)

Thanks. Then its safe to say that changing the free() in unlock_user()
to g_free() would do the job for the malloc() to g_malloc() change in
lock_user().

>
> thanks
> -- PMM



-- 

With regards,

Md Haris Iqbal,
Placement Coordinator, MTech IT
NITK Surathkal,
Contact: +91 8861996962



reply via email to

[Prev in Thread] Current Thread [Next in Thread]