From nobody Sun May 5 14:29:49 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 1492399997191696.20109516196; Sun, 16 Apr 2017 20:33:17 -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 DD30D7AE83; Mon, 17 Apr 2017 03:33:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B7B27835E; Mon, 17 Apr 2017 03:33:12 +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 3145D4ED31; Mon, 17 Apr 2017 03:33:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3H3X2Ll012180 for ; Sun, 16 Apr 2017 23:33:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDD7417A75; Mon, 17 Apr 2017 03:33:02 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D63A6784DA for ; Mon, 17 Apr 2017 03:33:00 +0000 (UTC) Received: from dggrg03-dlp.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E4BD3D952 for ; Mon, 17 Apr 2017 03:32:57 +0000 (UTC) Received: from 172.30.72.57 (EHLO dggeml406-hub.china.huawei.com) ([172.30.72.57]) by dggrg03-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ALY73818; Mon, 17 Apr 2017 11:32:55 +0800 (CST) Received: from localhost (10.177.17.7) by dggeml406-hub.china.huawei.com (10.3.17.50) with Microsoft SMTP Server id 14.3.301.0; Mon, 17 Apr 2017 11:32:47 +0800 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DD30D7AE83 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: ext-mx01.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 DD30D7AE83 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9E4BD3D952 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=king.wang@huawei.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9E4BD3D952 From: Wang King To: Date: Mon, 17 Apr 2017 11:32:29 +0800 Message-ID: <20170417033229.9736-1-king.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.17.7] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.58F43767.00B0, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c8351649f7580a06d12fe9a60cbdf324 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 17 Apr 2017 03:33:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 17 Apr 2017 03:33:00 +0000 (UTC) for IP:'45.249.212.189' DOMAIN:'szxga03-in.huawei.com' HELO:'dggrg03-dlp.huawei.com' FROM:'king.wang@huawei.com' RCPT:'' X-RedHat-Spam-Score: 0.798 (BAYES_50, RP_MATCHES_RCVD, SPF_PASS) 45.249.212.189 szxga03-in.huawei.com 45.249.212.189 szxga03-in.huawei.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: yanqiangjun@huawei.com, weidong.huang@huawei.com, Wang King , weifuqiang@huawei.com Subject: [libvirt] [PATCH v2] daemon: Fix domain name leak in error path 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: , 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.25]); Mon, 17 Apr 2017 03:33:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Domain name duplicated in make_nonnull_domain, but not freed when virTypedP= aramsSerialize return negative. Remove useless error label incidentally. --- daemon/remote.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 1610fea..d8a55c7 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -648,7 +648,7 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn, /* build return data */ memset(&data, 0, sizeof(data)); if (VIR_STRDUP(data.path, path) < 0) - goto error; + return -1; data.type =3D type; data.status =3D status; make_nonnull_domain(&data.dom, dom); @@ -667,9 +667,6 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn, } =20 return 0; - error: - VIR_FREE(data.path); - return -1; } =20 =20 @@ -1025,7 +1022,7 @@ remoteRelayDomainEventBlockJob2(virConnectPtr conn, memset(&data, 0, sizeof(data)); data.callbackID =3D callback->callbackID; if (VIR_STRDUP(data.dst, dst) < 0) - goto error; + return -1; data.type =3D type; data.status =3D status; make_nonnull_domain(&data.dom, dom); @@ -1035,9 +1032,6 @@ remoteRelayDomainEventBlockJob2(virConnectPtr conn, (xdrproc_t)xdr_remote_domain_event_block= _job_2_msg, &data); =20 return 0; - error: - VIR_FREE(data.dst); - return -1; } =20 =20 @@ -1067,7 +1061,7 @@ remoteRelayDomainEventTunable(virConnectPtr conn, (virTypedParameterRemotePtr *) &data.param= s.params_val, &data.params.params_len, VIR_TYPED_PARAM_STRING_OKAY) < 0) - return -1; + goto error; =20 remoteDispatchObjectEventSend(callback->client, remoteProgram, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABL= E, @@ -1075,6 +1069,10 @@ remoteRelayDomainEventTunable(virConnectPtr conn, &data); =20 return 0; + error: + VIR_FREE(data.dom.name); + return -1; + } =20 =20 @@ -1207,13 +1205,16 @@ remoteRelayDomainEventJobCompleted(virConnectPtr co= nn, (virTypedParameterRemotePtr *) &data.param= s.params_val, &data.params.params_len, VIR_TYPED_PARAM_STRING_OKAY) < 0) - return -1; + goto error; =20 remoteDispatchObjectEventSend(callback->client, remoteProgram, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_CO= MPLETED, (xdrproc_t)xdr_remote_domain_event_callb= ack_job_completed_msg, &data); return 0; + error: + VIR_FREE(data.dom.name); + return -1; } =20 =20 --=20 2.8.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list