From nobody Tue Feb 10 09:24:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1672922004; cv=none; d=zohomail.com; s=zohoarc; b=KZH7sbPRzFCseCZ8k94LaTbv9Fpgxyq0fQK1EBVQ6yfiJWN6cylFSQ1Uoc699MXO87dbmu7ZROPdmUIzraG5sDLMi/KAx2FfK0VE8tL5axnaSoaw9HcoG9AUyRn3IoWVJsXisBTEN2DdEET8sRuPhurXYOYHuQKJLAxbLjnP01A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672922004; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=m0QFghfrd39npiOjPPVeNMtMSRlUCKHc+GGEwPAq/lM=; b=b+wiW5vYCx9IH/KoJO7jitkWgiD/iBtv2U0mOxoSQSDVPK+oyz54sBhdoHV1KVBQwGof9uGax82efmTGMtN5IPFpOVARGfhuNzYXPa4Q21q5uI+Ijm1xcKYPUepWWrJ6PBvJjCq9/XjNP6B9UBJ57PqDDQHlBKCkBwGnDhILthg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1672922004767681.3099029520987; Thu, 5 Jan 2023 04:33:24 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-456-N_dmOw-4Ps6HlE-gp6ZuHQ-1; Thu, 05 Jan 2023 07:33:19 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C2EE38123C4; Thu, 5 Jan 2023 12:33:16 +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 6DB712166B34; Thu, 5 Jan 2023 12:33:16 +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 50B4D19465B5; Thu, 5 Jan 2023 12:33:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8221E1946586 for ; Thu, 5 Jan 2023 12:33:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 64B224085725; Thu, 5 Jan 2023 12:33:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C55C4085729 for ; Thu, 5 Jan 2023 12:33:14 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3AF6B857D0D for ; Thu, 5 Jan 2023 12:33:14 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-524-KZalsT3nOKmWUwwah5BNoQ-1; Thu, 05 Jan 2023 07:33:11 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Nnm702zrdznTXG for ; Thu, 5 Jan 2023 20:31:40 +0800 (CST) Received: from localhost.localdomain (10.175.124.27) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 5 Jan 2023 20:33:07 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672922003; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=m0QFghfrd39npiOjPPVeNMtMSRlUCKHc+GGEwPAq/lM=; b=XJHPjBAlAu/2HfKbwkF1Hn1HtUZ/rAhl/P3pPg7nSlKGNY6FD9IlVuqjRD3jvOmq/HWWYp 1j4bOc3BRzHWa3ZgU3PL+5E87I3iEgePYJULmyhYE3tNT10DCHPcx6BDv+y57n2CfpZjZc dROR1kKXpPy5xVWKflzhCBAJkARqMUc= X-MC-Unique: N_dmOw-4Ps6HlE-gp6ZuHQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: KZalsT3nOKmWUwwah5BNoQ-1 From: Jiang Jiacheng To: Subject: [PATCH 8/9] vmware: use g_autofree and remove unnecessary label Date: Thu, 5 Jan 2023 20:26:54 +0800 Message-ID: <20230105122655.3413625-9-jiangjiacheng@huawei.com> In-Reply-To: <20230105122655.3413625-1-jiangjiacheng@huawei.com> References: <20230105122655.3413625-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: , Cc: yubihong@huawei.com, zhengchuan@huawei.com, linyilu@huawei.com, jiangjiacheng@huawei.com, xiexiangyou@huawei.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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: 1672922006384100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiang Jiacheng --- src/vmware/vmware_conf.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 80a85f4d0f..5703ce717e 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -338,9 +338,8 @@ int vmwareVmxPath(virDomainDef *vmdef, char **vmxPath) { virDomainDiskDef *disk =3D NULL; - char *directoryName =3D NULL; - char *fileName =3D NULL; - int ret =3D -1; + g_autofree char *directoryName =3D NULL; + g_autofree char *fileName =3D NULL; size_t i; const char *src; =20 @@ -355,7 +354,7 @@ vmwareVmxPath(virDomainDef *vmdef, char **vmxPath) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Domain XML doesn't contain any disks, " "cannot deduce datastore and path for VMX file")); - goto cleanup; + return -1; } =20 for (i =3D 0; i < vmdef->ndisks; ++i) { @@ -370,7 +369,7 @@ vmwareVmxPath(virDomainDef *vmdef, char **vmxPath) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Domain XML doesn't contain any file-based harddi= sks, " "cannot deduce datastore and path for VMX file")); - goto cleanup; + return -1; } =20 src =3D virDomainDiskGetSource(disk); @@ -378,27 +377,22 @@ vmwareVmxPath(virDomainDef *vmdef, char **vmxPath) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("First file-based harddisk has no source, cannot " "deduce datastore and path for VMX file")); - goto cleanup; + return -1; } =20 if (vmwareParsePath(src, &directoryName, &fileName) < 0) - goto cleanup; + return -1; =20 if (!virStringHasCaseSuffix(fileName, ".vmdk")) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Expecting source '%s' of first file-based harddi= sk " "to be a VMDK image"), src); - goto cleanup; + return -1; } =20 vmwareConstructVmxPath(directoryName, vmdef->name, vmxPath); =20 - ret =3D 0; - - cleanup: - VIR_FREE(directoryName); - VIR_FREE(fileName); - return ret; + return 0; } =20 int @@ -436,8 +430,8 @@ vmwareMakePath(char *srcDir, char *srcName, char *srcEx= t, char **outpath) int vmwareExtractPid(const char * vmxPath) { - char *vmxDir =3D NULL; - char *logFilePath =3D NULL; + g_autofree char *vmxDir =3D NULL; + g_autofree char *logFilePath =3D NULL; FILE *logFile =3D NULL; char line[1024]; char *tmp =3D NULL; @@ -473,8 +467,6 @@ vmwareExtractPid(const char * vmxPath) } =20 cleanup: - VIR_FREE(vmxDir); - VIR_FREE(logFilePath); VIR_FORCE_FCLOSE(logFile); return pid_value; } --=20 2.33.0