From nobody Mon Feb 9 13:58:54 2026 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1513087861864608.8988103389756; Tue, 12 Dec 2017 06:11:01 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B3FF2D1EE9; Tue, 12 Dec 2017 14:10:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 394A94F9D8; Tue, 12 Dec 2017 14:10:58 +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 061EC389B; Tue, 12 Dec 2017 14:10:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vBCEAobo024630 for ; Tue, 12 Dec 2017 09:10:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id C02C863B81; Tue, 12 Dec 2017 14:10:50 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 480B8620DA for ; Tue, 12 Dec 2017 14:10:48 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 12 Dec 2017 15:10:38 +0100 Message-Id: <48f9f46c3b2cb6e008ce849bfafb72ce644931b8.1513087818.git.mprivozn@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] fillQemuCaps: Don't leak machine string 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 12 Dec 2017 14:11:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" =3D=3D25251=3D=3D 5 bytes in 1 blocks are definitely lost in loss record 7 = of 81 =3D=3D25251=3D=3D at 0x4C2BEDF: malloc (vg_replace_malloc.c:299) =3D=3D25251=3D=3D by 0x967E379: strdup (in /lib64/libc-2.25.so) =3D=3D25251=3D=3D by 0x5366F9F: virStrdup (virstring.c:941) =3D=3D25251=3D=3D by 0x538BF1D: virDomainCapsNew (domain_capabilities.c:= 121) =3D=3D25251=3D=3D by 0x10EACE: test_virDomainCapsFormat (domaincapstest.= c:295) =3D=3D25251=3D=3D by 0x10FBD2: virTestRun (testutils.c:180) =3D=3D25251=3D=3D by 0x10F192: mymain (domaincapstest.c:457) =3D=3D25251=3D=3D by 0x111C7F: virTestMain (testutils.c:1119) =3D=3D25251=3D=3D by 0x10FA3C: main (domaincapstest.c:528) Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- tests/domaincapstest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 76494a01c..533a4b379 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -159,10 +159,12 @@ fillQemuCaps(virDomainCapsPtr domCaps, !(qemuCaps =3D qemuTestParseCapabilities(caps, path))) goto cleanup; =20 - if (machine && - VIR_STRDUP(domCaps->machine, - virQEMUCapsGetCanonicalMachine(qemuCaps, machine)) < 0) - goto cleanup; + if (machine) { + VIR_FREE(domCaps->machine); + if (VIR_STRDUP(domCaps->machine, + virQEMUCapsGetCanonicalMachine(qemuCaps, machine)) = < 0) + goto cleanup; + } =20 if (!domCaps->machine && VIR_STRDUP(domCaps->machine, --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list