[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] small memory leak due to MachineClass rework
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] small memory leak due to MachineClass rework |
Date: |
Mon, 17 Mar 2014 21:25:19 +0000 |
On 17 March 2014 20:56, Christian Borntraeger <address@hidden> wrote:
> Turns out that valgrind is right. We simply forget the memory that
> g_strconcat has allocated.
> This fixes the small leak, but I have to cast away the constness of .name.
> Any better ideas?
It's how cpu_register() in target-arm/cpu.c does the same thing
(though we use void* rather than gpointer as the cast).
If you really dislike the const I guess you could use:
char *name = g_strconcat(...);
TypeInfo ti = {
.name = name,
[...]
};
[...]
g_free(name);
thanks
-- PMM