From nobody Mon May 6 16:05:48 2024 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.zoho.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 1493912560052645.4122583624459; Thu, 4 May 2017 08:42:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3244480044; Thu, 4 May 2017 15:42:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2C6318408; Thu, 4 May 2017 15:42:35 +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 CE0CC5EC68; Thu, 4 May 2017 15:42:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v44FgVb5012436 for ; Thu, 4 May 2017 11:42:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id CBD7A7890F; Thu, 4 May 2017 15:42:31 +0000 (UTC) Received: from moe.brq.redhat.com (dhcp129-131.brq.redhat.com [10.34.129.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4419377E32; Thu, 4 May 2017 15:42:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3244480044 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3244480044 From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 4 May 2017 17:42:09 +0200 Message-Id: <86805d119e02ee153d991c0295a0a50d37b6f359.1493912529.git.mprivozn@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] virNWFilterObjListFree: Don't leak nwfilters->objs 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 04 May 2017 15:42:38 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When adding a nwfilter onto the list in virNWFilterObjListAssignDef() this array is re-allocated to match demand for new size. However, it is never freed leading to a leak: =3D=3D26535=3D=3D 136 bytes in 1 blocks are definitely lost in loss record = 1,079 of 1,250 =3D=3D26535=3D=3D at 0x4C2E2BE: realloc (vg_replace_malloc.c:785) =3D=3D26535=3D=3D by 0x54BA28E: virReallocN (viralloc.c:245) =3D=3D26535=3D=3D by 0x54BA384: virExpandN (viralloc.c:294) =3D=3D26535=3D=3D by 0x54BA657: virInsertElementsN (viralloc.c:436) =3D=3D26535=3D=3D by 0x55DB011: virNWFilterObjListAssignDef (virnwfilter= obj.c:362) =3D=3D26535=3D=3D by 0x55DB530: virNWFilterObjListLoadConfig (virnwfilte= robj.c:503) =3D=3D26535=3D=3D by 0x55DB635: virNWFilterObjListLoadAllConfigs (virnwf= ilterobj.c:539) =3D=3D26535=3D=3D by 0x2AC5A28B: nwfilterStateInitialize (nwfilter_drive= r.c:250) =3D=3D26535=3D=3D by 0x5621C64: virStateInitialize (libvirt.c:770) =3D=3D26535=3D=3D by 0x124379: daemonRunStateInit (libvirtd.c:881) =3D=3D26535=3D=3D by 0x554AC78: virThreadHelper (virthread.c:206) =3D=3D26535=3D=3D by 0x8F5F493: start_thread (in /lib64/libpthread-2.23.= so) Signed-off-by: Michal Privoznik --- src/conf/virnwfilterobj.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/virnwfilterobj.c b/src/conf/virnwfilterobj.c index c69407a..b5aaa6b 100644 --- a/src/conf/virnwfilterobj.c +++ b/src/conf/virnwfilterobj.c @@ -110,6 +110,7 @@ virNWFilterObjListFree(virNWFilterObjListPtr nwfilters) size_t i; for (i =3D 0; i < nwfilters->count; i++) virNWFilterObjFree(nwfilters->objs[i]); + VIR_FREE(nwfilters->objs); VIR_FREE(nwfilters); } =20 --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list