From nobody Sat May 18 18:27:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1674826672; cv=none; d=zohomail.com; s=zohoarc; b=ZutzSpo4f7SAd08ZI0CzH1UNOxq6KaoY0RMgdU7HA2eCxRixviHB/Qkt45l3E4GBOTYQll0I1tX+yBp/JpOGdI/LpFaVNyLcrlLyQ/CrxQgYDNq4bvVmxGrcFLm6+/9GBbFZeI9UiobicREdbKxijekVgz/RKdipGMMlehuZ52g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674826672; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=kgxag0SzxKZW7wCi78QU1qL5BpXYRXxYjhgrre4dr3g=; b=XuIFH8dOd8H7qQ3/I8BcXJoWsBGPrZDxUIz9p5AtdyGdBI00xQIWXNkCq/43Fgv9nj6+XXLkMxrGx7YsMoWTDVp8W1zGDCohcKVa8o80kL0NSqIbnFH01+gfnjfzmyxHyX9s4SeakLQzU9HrEKUTavXhXfxRn+7dGSkeqcM3CfA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1674826672381602.0936145658349; Fri, 27 Jan 2023 05:37:52 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-451-LgEG8uiJM2qSJBFKorCXsw-1; Fri, 27 Jan 2023 08:37:44 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 91322802D1A; Fri, 27 Jan 2023 13:37:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 180252026D4B; Fri, 27 Jan 2023 13:37:38 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E1095194658D; Fri, 27 Jan 2023 13:37:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B31D2194658D for ; Fri, 27 Jan 2023 13:37:31 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BEDD718EC2; Fri, 27 Jan 2023 13:37:31 +0000 (UTC) Received: from rein.int.mamuti.net (ovpn-194-38.brq.redhat.com [10.40.194.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F72B7AD4 for ; Fri, 27 Jan 2023 13:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674826671; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kgxag0SzxKZW7wCi78QU1qL5BpXYRXxYjhgrre4dr3g=; b=exDo9UaQiTk3GwepVUKzLaeHlaWLL7oNFGmmQWo3pgttbteeMw1vKs/1PmUqveyNkJDi83 Zz4H5cBjhoZ1urI46D9H+MlX4G6a9dz0nYeAzL3boBCm6YDanj3tz0OnHZTlnsyPu4zFwL Po+nUl3D9iBoOkIjHsn3pTbzbTKLjq0= X-MC-Unique: LgEG8uiJM2qSJBFKorCXsw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH] remote: Fix memory leak in remoteDomainMigrateFinish3* Date: Fri, 27 Jan 2023 14:37:29 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1674826674015100001 Content-Type: text/plain; charset="utf-8" Theoretically, when remoteDomainMigrateFinish3* is called without a pointer for storing migration cookie and its length (i.e., either cookieout =3D=3D NULL or cookieoutlen =3D=3D NULL), we would leak the fresh= ly created virDomain object referenced by rv. Signed-off-by: Jiri Denemark Reviewed-by: Erik Skultety --- src/remote/remote_driver.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 2f421fb5e0..9fc73f6d88 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -5917,8 +5917,6 @@ remoteDomainMigrateFinish3(virConnectPtr dconn, (xdrproc_t) xdr_remote_domain_migrate_finish3_ret, (char *) &= ret) =3D=3D -1) return NULL; =20 - rv =3D get_nonnull_domain(dconn, ret.dom); - if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -5930,6 +5928,8 @@ remoteDomainMigrateFinish3(virConnectPtr dconn, ret.cookie_out.cookie_out_len =3D 0; } =20 + rv =3D get_nonnull_domain(dconn, ret.dom); + xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_ret, (char *) = &ret); =20 return rv; @@ -6770,8 +6770,6 @@ remoteDomainMigrateFinish3Params(virConnectPtr dconn, (char *) &ret) =3D=3D -1) goto cleanup; =20 - rv =3D get_nonnull_domain(dconn, ret.dom); - if (ret.cookie_out.cookie_out_len > 0) { if (!cookieout || !cookieoutlen) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -6783,6 +6781,8 @@ remoteDomainMigrateFinish3Params(virConnectPtr dconn, ret.cookie_out.cookie_out_len =3D 0; } =20 + rv =3D get_nonnull_domain(dconn, ret.dom); + xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_params_ret, (char *) &ret); =20 --=20 2.39.1