From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQMg4-00008O-84 for qemu-devel@nongnu.org; Wed, 19 Mar 2014 16:01:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQMfv-0001M6-89 for qemu-devel@nongnu.org; Wed, 19 Mar 2014 16:01:28 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57136 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQMfv-0001Lo-1P for qemu-devel@nongnu.org; Wed, 19 Mar 2014 16:01:19 -0400 Message-ID: <5329F78C.9020601@suse.de> Date: Wed, 19 Mar 2014 21:01:16 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1395228267-34202-1-git-send-email-borntraeger@de.ibm.com> <20140319132148.GA27827@redhat.com> In-Reply-To: <20140319132148.GA27827@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 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: "Michael S. Tsirkin" Cc: Christian Borntraeger , Marcel Apfelbaum , "qemu-devel@nongnu.org" , Peter Maydell Am 19.03.2014 14:21, schrieb Michael S. Tsirkin: > On Wed, Mar 19, 2014 at 12:24:27PM +0100, Christian Borntraeger wrote: >> since commit 261747f176f6 (vl: Use MachineClass instead of global >> QEMUMachine list) valgrind complains about the following: >> >> =3D=3D54082=3D=3D 57 bytes in 3 blocks are definitely lost in loss rec= ord 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) >> >> 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. >> >> Signed-off-by: Christian Borntraeger >=20 > Reviewed-by: Michael S. Tsirkin >=20 > Andreas can you pick this up pls? I already had - updated with your Rb now. Thanks, 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