qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] xtensa: use g_malloc/g_new/g_free


From: Max Filippov
Subject: Re: [Qemu-devel] [PATCH] xtensa: use g_malloc/g_new/g_free
Date: Mon, 8 May 2017 10:05:59 -0700

On Mon, May 8, 2017 at 6:32 AM, Alex Bennée <address@hidden> wrote:
>> diff --git a/hw/xtensa/sim.c b/hw/xtensa/sim.c
>> index d2d1d3a6fd..97307728f7 100644
>> --- a/hw/xtensa/sim.c
>> +++ b/hw/xtensa/sim.c
>> @@ -41,13 +41,13 @@ static void xtensa_create_memory_regions(const 
>> XtensaMemory *memory,
>>                                           const char *name)
>>  {
>>      unsigned i;
>> -    char *num_name = malloc(strlen(name) + sizeof(i) * 3 + 1);
>> +    char *num_name = g_malloc(strlen(name) + sizeof(i) * 3 + 1);
>
> It seems a little sketchy using the size of the storage type as a proxy
> for the number of bytes used by the format specifier in a format string.
> In this sort of situation I'd just use Glib and stop worrying about it:

Ok, I'll send a patch doing it that way.

-- 
Thanks.
-- Max



reply via email to

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