From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"Andreas Färber" <afaerber@suse.de>,
"Marcel Apfelbaum" <marcel.a@redhat.com>
Subject: Re: [Qemu-devel] small memory leak due to MachineClass rework
Date: Mon, 17 Mar 2014 22:29:01 +0100 [thread overview]
Message-ID: <5327691D.3040906@de.ibm.com> (raw)
In-Reply-To: <CAFEAcA_Oan+QDy2PJswK8jdaadp3gdtj-rrHaT1aAb+i6B3ybw@mail.gmail.com>
On 17/03/14 22:25, Peter Maydell wrote:
> On 17 March 2014 20:56, Christian Borntraeger <borntraeger@de.ibm.com> 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).
Ok, if you dont have a problem with that approach, I can submit a proper
patch with signoff. Any preference regarding void * vs gpointer?
Christian
> If you really dislike the const I guess you could use:
> char *name = g_strconcat(...);
> TypeInfo ti = {
> .name = name,
> [...]
> };
> [...]
> g_free(name);
>
next prev parent reply other threads:[~2014-03-17 21:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-17 20:56 [Qemu-devel] small memory leak due to MachineClass rework Christian Borntraeger
2014-03-17 21:25 ` Peter Maydell
2014-03-17 21:29 ` Christian Borntraeger [this message]
2014-03-17 21:38 ` Andreas Färber
2014-03-17 21:43 ` Marcel Apfelbaum
2014-03-18 14:57 ` Michael S. Tsirkin
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=5327691D.3040906@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=afaerber@suse.de \
--cc=marcel.a@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.