From nobody Wed May 14 00:04:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1528283604726462.1403615186696; Wed, 6 Jun 2018 04:13:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE97D3082A33; Wed, 6 Jun 2018 11:13:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A33E7608F2; Wed, 6 Jun 2018 11:13:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 180011800FC1; Wed, 6 Jun 2018 11:13:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w56BDLd0012956 for ; Wed, 6 Jun 2018 07:13:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 23ADA111AF15; Wed, 6 Jun 2018 11:13:21 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAC97111AF0F for ; Wed, 6 Jun 2018 11:13:20 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 6 Jun 2018 13:13:13 +0200 Message-Id: <6980fed0de66ff1f7298f17da95ba92eddf6daf3.1528283568.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] qemu: Fix memleak in qemuBuildNumaArgStr X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 06 Jun 2018 11:13:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We are allocating each individual buffer in @nodeBackends array but never free it. =3D=3D22516=3D=3D 96 bytes in 4 blocks are definitely lost in loss record 1= 66 of 195 =3D=3D22516=3D=3D at 0x4C2EF26: calloc (vg_replace_malloc.c:711) =3D=3D22516=3D=3D by 0x5D2C7D5: virAlloc (viralloc.c:144) =3D=3D22516=3D=3D by 0x56FAABD: qemuBuildNumaArgStr (qemu_command.c:7543) =3D=3D22516=3D=3D by 0x5701835: qemuBuildCommandLine (qemu_command.c:101= 12) =3D=3D22516=3D=3D by 0x575D794: qemuProcessCreatePretendCmd (qemu_proces= s.c:6568) =3D=3D22516=3D=3D by 0x113338: testCompareXMLToArgv (qemuxml2argvtest.c:= 549) =3D=3D22516=3D=3D by 0x138CA3: virTestRun (testutils.c:180) =3D=3D22516=3D=3D by 0x136CD1: mymain (qemuxml2argvtest.c:2825) =3D=3D22516=3D=3D by 0x13AD58: virTestMain (testutils.c:1118) =3D=3D22516=3D=3D by 0x137351: main (qemuxml2argvtest.c:2874) Signed-off-by: Michal Privoznik --- src/qemu/qemu_command.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e85c5ef804..fb5bb26ad1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7641,8 +7641,10 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, VIR_FREE(cpumask); =20 if (nodeBackends) { - for (i =3D 0; i < ncells; i++) + for (i =3D 0; i < ncells; i++) { virBufferFreeAndReset(nodeBackends[i]); + VIR_FREE(nodeBackends[i]); + } =20 VIR_FREE(nodeBackends); } --=20 2.16.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list