From nobody Fri May 3 14:51:37 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.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1527079267618686.0657949802251; Wed, 23 May 2018 05:41:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ABB2730D455E; Wed, 23 May 2018 12:41:05 +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 0FF6160BE5; Wed, 23 May 2018 12:41:05 +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 A83394CA82; Wed, 23 May 2018 12:41:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4NCexB0010228 for ; Wed, 23 May 2018 08:40:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id E0BBC58A65; Wed, 23 May 2018 12:40:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA71758A61 for ; Wed, 23 May 2018 12:40:56 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5D96316B793 for ; Wed, 23 May 2018 12:40:45 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id a67-v6so8517860wmf.3 for ; Wed, 23 May 2018 05:40:45 -0700 (PDT) Received: from rolandPC.redhat.com ([213.175.37.12]) by smtp.gmail.com with ESMTPSA id o2-v6sm1609175wmo.24.2018.05.23.05.40.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 05:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=DPKMk7z1aWfRpsETUmbCMf/SRZvKI3vjPFHVX5F/+3w=; b=tOiJKMgb822BXdUckCNNddQJRG+8V05CFio3PMEKnhF19g3IT7viPjrq2hOpPZufQ3 FGMDb5+ugjCAQcCwHkRQDA/R0gN3QGNiCj4DKYkHhUEtIM/fFkdG8Lu2ioO2S/jLB+Ah 82iZcfy1EamUwYV4dFP2x16n6S9bXpz6RI7u5pTpQUkfOaAlxd5T3FozKwsC9hsVxUFy VipIKb+sTE6SceppYPKgv7lDVsxFtuPXboEg48pCWKfd9bnno/6EklXhvU9Sfnd940Ti bpZI2Ji+NLvzop2qIZta5auhv1V0unwCeQmmj9TStoTyRk8Q5HUyXPThDLpvoPPvC7Nh owdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=DPKMk7z1aWfRpsETUmbCMf/SRZvKI3vjPFHVX5F/+3w=; b=fIjE0yrdivYTzT+Kt9SE5wiVLxgH7v9a6sSlyGjEjqYeN7OefGZWhpXPA69aA/jC6a 1aZ5Q0HJJcvSFYo9b7luTWqsSR1RSKl505/zvmmBxPQGASTk5B/EJqUQlKymnofjIT3x Wui3m94yEhQcXtdyjDwPU4gmP/Ai2HFCSoxTXyEdAbRJ8ArNWJHY+6fCtUMlmYlS3rkh xbQprURlUykwmBpcaPi1UytjMpBqwBQpRASQavogsC7VIm0glAIA4OnXdR6GtRUUbDZF IaOt5lSymdBdDADaexIxFLhG8RjsdXPqn+H9GB6uvVullLe4wOBfHRLuZLfjzsQh8kyg ZyYA== X-Gm-Message-State: ALKqPwcXSpW4+428RKrOGDBG6TGv5asgQjd8CDMc8xeztGb+I7RofgQF 5JnyQhSW5GLQnEeJg2jQFduDSw== X-Google-Smtp-Source: AB8JxZpWgSsHlXr68FSDovABteNWG+EoB1EKj9BpURiX0W/1mSyPE0TMMu+6uaMVt/9Lmqyf6DSMuw== X-Received: by 2002:a1c:7407:: with SMTP id p7-v6mr3742830wmc.132.1527079244400; Wed, 23 May 2018 05:40:44 -0700 (PDT) From: Roland Schulz To: libvir-list@redhat.com Date: Wed, 23 May 2018 14:40:41 +0200 Message-Id: <20180523124041.15108-2-schullzroll@gmail.com> In-Reply-To: <20180523124041.15108-1-schullzroll@gmail.com> References: <20180523124041.15108-1-schullzroll@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 23 May 2018 12:40:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 23 May 2018 12:40:46 +0000 (UTC) for IP:'74.125.82.66' DOMAIN:'mail-wm0-f66.google.com' HELO:'mail-wm0-f66.google.com' FROM:'schullzroll@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.281 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 74.125.82.66 mail-wm0-f66.google.com 74.125.82.66 mail-wm0-f66.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] Fix memory leak issues in virshAllocpagesPagesizeCompleter. 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 23 May 2018 12:41:06 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Roland Schulz --- tools/virsh-completer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 1435d1d4c..c72f3bcad 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -576,6 +576,7 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl, virshControlPtr priv =3D ctl->privData; unsigned int npages =3D 0; xmlNodePtr *pages =3D NULL; + xmlDocPtr doc =3D NULL; double size =3D 0; size_t i =3D 0; const char *suffix =3D NULL; @@ -595,7 +596,7 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl, if (!(cap_xml =3D virConnectGetCapabilities(priv->conn))) goto error; =20 - if (!(virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt))) + if ((doc =3D virXMLParseStringCtxt(cap_xml, _("capabilities"), &ctxt))= =3D=3D NULL) goto error; =20 if (cellno && vshCommandOptStringQuiet(ctl, cmd, "cellno", &cellnum) >= 0) { @@ -631,12 +632,11 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl, =20 cleanup: xmlXPathFreeContext(ctxt); - for (i =3D 0; i < npages; i++) - VIR_FREE(pages[i]); VIR_FREE(pages); - VIR_FREE(cap_xml); + xmlFreeDoc(doc); VIR_FREE(path); VIR_FREE(pagesize); + VIR_FREE(cap_xml); VIR_FREE(unit); =20 return ret; --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list