From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQFK6-0000AQ-4A for qemu-devel@nongnu.org; Wed, 19 Mar 2014 08:10:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQFJz-0007eN-N7 for qemu-devel@nongnu.org; Wed, 19 Mar 2014 08:10:18 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48725 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQFJz-0007cP-Aq for qemu-devel@nongnu.org; Wed, 19 Mar 2014 08:10:11 -0400 Message-ID: <53298921.5070604@suse.de> Date: Wed, 19 Mar 2014 13:10:09 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1395228267-34202-1-git-send-email-borntraeger@de.ibm.com> In-Reply-To: <1395228267-34202-1-git-send-email-borntraeger@de.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCHv2] vl.c: Fix memory leak in qemu_register_machine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christian Borntraeger Cc: Peter Maydell , "Michael S. Tsirkin" , "qemu-devel@nongnu.org" , Marcel Apfelbaum Am 19.03.2014 12:24, schrieb Christian Borntraeger: > since commit 261747f176f6 (vl: Use MachineClass instead of global > QEMUMachine list) valgrind complains about the following: >=20 > =3D=3D54082=3D=3D 57 bytes in 3 blocks are definitely lost in loss reco= rd 365 of > 729 > =3D=3D54082=3D=3D at 0x4031AFE: malloc (vg_replace_malloc.c:292) > =3D=3D54082=3D=3D by 0x4145569: g_malloc (in > /usr/lib64/libglib-2.0.so.0.3400.2) > =3D=3D54082=3D=3D by 0x415F9E9: g_strconcat (in > /usr/lib64/libglib-2.0.so.0.3400.2) > =3D=3D54082=3D=3D by 0x80157FE7: qemu_register_machine (vl.c:1597) > =3D=3D54082=3D=3D by 0x80208E6B: module_call_init (module.c:105) > =3D=3D54082=3D=3D by 0x80013B91: main (vl.c:3000) >=20 > Turns out that valgrind is right. We simply forget the memory that > g_strconcat has allocated. Lets free it after the type_register. > We need a 2nd variable due to constness of the name part of the > type structure. >=20 > Signed-off-by: Christian Borntraeger Thanks, applied to qom-next (using standard syntax for function names): https://github.com/afaerber/qemu-cpu/commits/qom-next Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg