From nobody Fri May 17 02:41:17 2024 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1655876147; cv=none; d=zohomail.com; s=zohoarc; b=NLkqODPzyvOUiRx7aRjmrrnj+e78zgrcD+u5tL2AZHoJY6n4sRrTTkb5yESmIaTuzgZ+9L9/KKUS3DSLzHyYaQjMihTU9/+F7qebQtok7fTgvsarNWk/IMZE9IIZDFaPJjiIV6Z/2JIoWyTDqiLG/4miepTANEeeGFJYCu92W84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655876147; h=Content-Type:Content-Transfer-Encoding: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=xg9FyduwK/kXwuk+m2TQCzgOIvpauinEM+EU00yR0MU=; b=mersvYySm5UHJ1aFUbUoB81eyuFfKtqZGn5cgmMeJqOhCkEwmur+65oInueEbD/hSKf7u1C3RNI8+j90xInEu3G8tNc/32GyMRbABNgJrlum44yv1W0HQRxWFCiM33Y2eQyTQ9C6DyrPJa2eneSp78Zgy//ucfal+GC812oOnXI= 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=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.133.124]) by mx.zohomail.com with SMTPS id 1655876147569483.09934562673106; Tue, 21 Jun 2022 22:35:47 -0700 (PDT) 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-426-AXMe56iYNLmUDYchxsQjwQ-1; Wed, 22 Jun 2022 01:35:41 -0400 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 091A93C0D19F; Wed, 22 Jun 2022 05:35:40 +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 EA5532027EB4; Wed, 22 Jun 2022 05:35:39 +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 B447E194704A; Wed, 22 Jun 2022 05:35:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 15FBA1947051 for ; Wed, 22 Jun 2022 05:35:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D66361121315; Wed, 22 Jun 2022 05:35:36 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E1C51121314 for ; Wed, 22 Jun 2022 05:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655876146; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xg9FyduwK/kXwuk+m2TQCzgOIvpauinEM+EU00yR0MU=; b=ELuNHvpQKoFCv4NO0+5br1rZL2+1Q6LPDKZ1eeS4g8o6qdwp1/dgNdfUT4MojMkBfra5sr gf5yh4mSpDgLyVrRcEgHNoybseWM+22Ncc6UO86LDIwAY4er46bwU9pUUXl0AvjsIIe201 npL5F/vc9YbVwdQtZjqxcEzLX+65LD4= X-MC-Unique: AXMe56iYNLmUDYchxsQjwQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/6] Use g_auto for virURI almost everywhere Date: Wed, 22 Jun 2022 07:35:29 +0200 Message-Id: <711777de50e33bc465eceafd07201cd549ebec08.1655876067.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1655876148067100006 Convert all the cases where we can unconditionally free the virURI at the end of scope. In libxlDomainMigrationDstPrepare, uri is only filled if uri_in was present, so moving the virURIFree out of the condition is safe. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Pavel Hrdina --- src/esx/esx_driver.c | 3 +-- src/libxl/libxl_migration.c | 7 ++----- src/qemu/qemu_migration.c | 3 +-- src/vmx/vmx.c | 3 +-- src/vz/vz_driver.c | 3 +-- src/vz/vz_sdk.c | 3 +-- tests/viruritest.c | 3 +-- 7 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 79b991f36f..9dc5489411 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -3658,7 +3658,7 @@ esxDomainMigratePerform(virDomainPtr domain, { int result =3D -1; esxPrivate *priv =3D domain->conn->privateData; - virURI *parsedUri =3D NULL; + g_autoptr(virURI) parsedUri =3D NULL; char *saveptr; char *path_resourcePool; char *path_hostSystem; @@ -3779,7 +3779,6 @@ esxDomainMigratePerform(virDomainPtr domain, result =3D 0; =20 cleanup: - virURIFree(parsedUri); esxVI_ObjectContent_Free(&virtualMachine); esxVI_Event_Free(&eventList); esxVI_ManagedObjectReference_Free(&task); diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index 0fd2b3206e..c5ec80139f 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -637,7 +637,7 @@ libxlDomainMigrationDstPrepare(virConnectPtr dconn, char *xmlout =3D NULL; unsigned short port; char portstr[100]; - virURI *uri =3D NULL; + g_autoptr(virURI) uri =3D NULL; virNetSocket **socks =3D NULL; size_t nsocks =3D 0; int nsocks_listen =3D 0; @@ -795,8 +795,6 @@ libxlDomainMigrationDstPrepare(virConnectPtr dconn, libxlMigrationCookieFree(mig); if (!uri_in) VIR_FREE(hostname); - else - virURIFree(uri); virObjectUnref(args); virDomainObjEndAPI(&vm); virObjectUnref(cfg); @@ -1183,7 +1181,7 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *dr= iver, char *hostname =3D NULL; unsigned short port =3D 0; char portstr[100]; - virURI *uri =3D NULL; + g_autoptr(virURI) uri =3D NULL; virNetSocket *sock; int sockfd =3D -1; int ret =3D -1; @@ -1233,7 +1231,6 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *dr= iver, =20 cleanup: VIR_FORCE_CLOSE(sockfd); - virURIFree(uri); return ret; } =20 diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 6e5b3839fb..3d7d5efda3 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2107,7 +2107,7 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriver *drive= r, int ret =3D -1; const char *listenAddress =3D NULL; virSocketAddr addr; - virURI *uri =3D NULL; + g_autoptr(virURI) uri =3D NULL; int type =3D -1; int port =3D -1; int tlsPort =3D -1; @@ -2192,7 +2192,6 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriver *drive= r, } =20 cleanup: - virURIFree(uri); return ret; } =20 diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index e24e9211aa..282e9562e0 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2903,7 +2903,7 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf, = int port, char network_endPoint_name[48] =3D ""; char *network_endPoint =3D NULL; =20 - virURI *parsedUri =3D NULL; + g_autoptr(virURI) parsedUri =3D NULL; =20 if (def =3D=3D NULL || *def !=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")= ); @@ -3051,7 +3051,6 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf, = int port, VIR_FREE(fileType); VIR_FREE(fileName); VIR_FREE(network_endPoint); - virURIFree(parsedUri); =20 return result; } diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 82323cb1b2..017c084ede 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -3074,7 +3074,7 @@ vzDomainMigratePerformStep(virDomainObj *dom, { int ret =3D -1; struct vzDomObj *privdom =3D dom->privateData; - virURI *vzuri =3D NULL; + g_autoptr(virURI) vzuri =3D NULL; const char *miguri =3D NULL; const char *dname =3D NULL; vzMigrationCookie *mig =3D NULL; @@ -3117,7 +3117,6 @@ vzDomainMigratePerformStep(virDomainObj *dom, cleanup: if (job) vzDomainObjEndJob(dom); - virURIFree(vzuri); vzMigrationCookieFree(mig); =20 return ret; diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 43d528820e..5ea3f29a8f 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -1133,7 +1133,7 @@ prlsdkGetSerialInfo(PRL_HANDLE serialPort, virDomainC= hrDef *chr) char *friendlyName =3D NULL; PRL_SERIAL_PORT_SOCKET_OPERATION_MODE socket_mode; char *uristr =3D NULL; - virURI *uri =3D NULL; + g_autoptr(virURI) uri =3D NULL; int ret =3D -1; =20 chr->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL; @@ -1196,7 +1196,6 @@ prlsdkGetSerialInfo(PRL_HANDLE serialPort, virDomainC= hrDef *chr) cleanup: VIR_FREE(friendlyName); VIR_FREE(uristr); - virURIFree(uri); =20 return ret; } diff --git a/tests/viruritest.c b/tests/viruritest.c index 94c8aa806d..7eb7c9cb67 100644 --- a/tests/viruritest.c +++ b/tests/viruritest.c @@ -46,7 +46,7 @@ struct URIParseData { static int testURIParse(const void *args) { int ret =3D -1; - virURI *uri =3D NULL; + g_autoptr(virURI) uri =3D NULL; const struct URIParseData *data =3D args; g_autofree char *uristr =3D NULL; size_t i; @@ -133,7 +133,6 @@ static int testURIParse(const void *args) =20 ret =3D 0; cleanup: - virURIFree(uri); return ret; } =20 --=20 2.34.1 From nobody Fri May 17 02:41:17 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=1655876146; cv=none; d=zohomail.com; s=zohoarc; b=KxcLSr6eB7Or0diY/Hv0EsgvXQ9Ec8wELGPlRwNo95plHtMV+a3N7OiOVwY8ef8xFTQBol/uQxgJNcC5PSGIzxXfO2GAPX3sbos/U0E7pa+hF3vKgL1Z/SIwu23scjuTP0aHuLF/uHs7v/XRWU4XUoJcMrvyhA6boAnqwXP6ZZA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655876146; h=Content-Type:Content-Transfer-Encoding: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=YTX4XWRTiJHXWZXtYrkFcNF5Hq2ByCZsVeAEPl/R4GQ=; b=e+tAVRViEu2OUiyYm8qmwbKigUc/uQmLniCeAHBR5wPq+MK8CbVWDv6m1tg/+KMWYJ7ijbTpngTBIlB+PLyDOK2+WOYDrszal8FMQ+Z1UEpPo18MDBLBYILB825YiQ2LJvW+ueqJfbZVArSMj7kre9MsXHrVBWeCgcDibB0BWCA= 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 1655876146469473.5006361724105; Tue, 21 Jun 2022 22:35:46 -0700 (PDT) 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-621-50COA6GsMCGYHjaZ7751LQ-1; Wed, 22 Jun 2022 01:35:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9721A18013A7; Wed, 22 Jun 2022 05:35:39 +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 2F7DE40EC002; Wed, 22 Jun 2022 05:35: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 64AA6194704C; Wed, 22 Jun 2022 05:35:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A71E7194704C for ; Wed, 22 Jun 2022 05:35:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 72D5B1121315; Wed, 22 Jun 2022 05:35:37 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AF531121314 for ; Wed, 22 Jun 2022 05:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655876145; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=YTX4XWRTiJHXWZXtYrkFcNF5Hq2ByCZsVeAEPl/R4GQ=; b=P0CL0HREDoJHts2fhT+VYNjfJabIADHQemj8p2AbkwV145EctvagKW2y62rUqgJ6oJAONf EQFI7L7cZae3rn74Tedyhoy5jnKv8BrSxbmsA1+HjwCAs15M10siKr7tY3d2k2rtD6UDnf 9SdXbdzWiJrJMen3TAwmEyZ2IsaAvsA= X-MC-Unique: 50COA6GsMCGYHjaZ7751LQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/6] tests: remove pointless label in testURIParse Date: Wed, 22 Jun 2022 07:35:30 +0200 Message-Id: <011746f72bc1f5ec3b253f448c11a62b171f9ae7.1655876067.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1655876148063100005 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Pavel Hrdina --- tests/viruritest.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/viruritest.c b/tests/viruritest.c index 7eb7c9cb67..cd6ce57371 100644 --- a/tests/viruritest.c +++ b/tests/viruritest.c @@ -45,7 +45,6 @@ struct URIParseData { =20 static int testURIParse(const void *args) { - int ret =3D -1; g_autoptr(virURI) uri =3D NULL; const struct URIParseData *data =3D args; g_autofree char *uristr =3D NULL; @@ -53,7 +52,7 @@ static int testURIParse(const void *args) bool fail =3D false; =20 if (!(uri =3D virURIParse(data->uri))) - goto cleanup; + return -1; =20 if (STRNEQ(uri->scheme, data->scheme)) { VIR_TEST_DEBUG("Expected scheme '%s', actual '%s'", @@ -120,7 +119,7 @@ static int testURIParse(const void *args) uri->query =3D virURIFormatParams(uri); =20 if (!(uristr =3D virURIFormat(uri))) - goto cleanup; + return -1; =20 if (STRNEQ(uristr, data->uri_out)) { VIR_TEST_DEBUG("URI did not roundtrip, expect '%s', actual '%s'", @@ -129,11 +128,9 @@ static int testURIParse(const void *args) } =20 if (fail) - goto cleanup; + return -1; =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 --=20 2.34.1 From nobody Fri May 17 02:41:17 2024 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1655876166; cv=none; d=zohomail.com; s=zohoarc; b=EutOCtFb6dLIeGxVJwara8S12utBxwOjNMdIZQqZeTW3a/PEZVE01qG/m9oWNq68lgih4cVN4Jr3QFm24lWM4KdxuYcI/i73UrkAtloOyqLkNeADVj4lBadzcdpMS4e6J5xuQJdIl5//GTyH+2hZRlkIdrTcDn5fcTZ4cCTex5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655876166; h=Content-Type:Content-Transfer-Encoding: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=jEx4HPWGgttQiNPLOR0UhpDiRYdyhPlOSdDfaj6uxw0=; b=WA3I8HP8ViZp4eHY2NF8Tvyn0WjOEHGcmGCc1tsnLxgdGrrZJFcwFhMYoUMALTJzOc7MYO2xF9Rz8HplzE0A6qKkcjbUC5f+VPppAxDqsRMDW/+ZB+J+ZZs3VqqYiR4QZ8eerN11NuKku0LzDuVFgArQ13VCfNdD4LZFEhuYf/0= 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=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.133.124]) by mx.zohomail.com with SMTPS id 165587616602024.015866643923346; Tue, 21 Jun 2022 22:36:06 -0700 (PDT) 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-147-CFsfw4CWNbuk_DF4bD1fMQ-1; Wed, 22 Jun 2022 01:35:42 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78FC8800DA8; Wed, 22 Jun 2022 05:35:40 +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 5DA8840EC005; Wed, 22 Jun 2022 05:35:40 +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 23B331947054; Wed, 22 Jun 2022 05:35:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1E57F1947042 for ; Wed, 22 Jun 2022 05:35:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 10107112131E; Wed, 22 Jun 2022 05:35:38 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC7331121314 for ; Wed, 22 Jun 2022 05:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655876164; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jEx4HPWGgttQiNPLOR0UhpDiRYdyhPlOSdDfaj6uxw0=; b=JO7paBc3cRsd5/sslNycYZ8MTf2h648qbITMKf6EqHJ030mItkwxw6XecEVfyoQYY/GJP4 UoOrbQ34dThgCjO1ehvIYArb1fNyZWqTXeo64K9H1JDkiKVHiJFaT2C1bTetSA5IcataZ6 UsoT0BTlVZJZDkLZKVyPBbQXXfM7vpU= X-MC-Unique: CFsfw4CWNbuk_DF4bD1fMQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/6] vz: refactor testURIParse Date: Wed, 22 Jun 2022 07:35:31 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1655876166305100001 Use g_autofree for the two strings still using manual cleanup and remove the pointless cleanup label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Pavel Hrdina --- src/vz/vz_sdk.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 5ea3f29a8f..ecf610d7db 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -1130,26 +1130,25 @@ prlsdkGetSerialInfo(PRL_HANDLE serialPort, virDomai= nChrDef *chr) PRL_RESULT pret; PRL_UINT32 serialPortIndex; PRL_UINT32 emulatedType; - char *friendlyName =3D NULL; + g_autofree char *friendlyName =3D NULL; PRL_SERIAL_PORT_SOCKET_OPERATION_MODE socket_mode; - char *uristr =3D NULL; + g_autofree char *uristr =3D NULL; g_autoptr(virURI) uri =3D NULL; - int ret =3D -1; =20 chr->deviceType =3D VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL; pret =3D PrlVmDev_GetIndex(serialPort, &serialPortIndex); - prlsdkCheckRetGoto(pret, cleanup); + prlsdkCheckRetExit(pret, -1); chr->target.port =3D serialPortIndex; =20 pret =3D PrlVmDev_GetEmulatedType(serialPort, &emulatedType); - prlsdkCheckRetGoto(pret, cleanup); + prlsdkCheckRetExit(pret, -1); =20 if (!(friendlyName =3D prlsdkGetStringParamVar(PrlVmDev_GetFriendlyNam= e, serialPort))) - goto cleanup; + return -1; =20 pret =3D PrlVmDevSerial_GetSocketMode(serialPort, &socket_mode); - prlsdkCheckRetGoto(pret, cleanup); + prlsdkCheckRetExit(pret, -1); =20 switch (emulatedType) { case PDT_USE_OUTPUT_FILE: @@ -1169,7 +1168,7 @@ prlsdkGetSerialInfo(PRL_HANDLE serialPort, virDomainC= hrDef *chr) chr->source->type =3D VIR_DOMAIN_CHR_TYPE_TCP; uristr =3D g_strdup_printf("tcp://%s", friendlyName); if (!(uri =3D virURIParse(uristr))) - goto cleanup; + return -1; chr->source->data.tcp.host =3D g_strdup(uri->server); chr->source->data.tcp.service =3D g_strdup_printf("%d", uri->port); chr->source->data.tcp.listen =3D socket_mode =3D=3D PSP_SERIAL_SOC= KET_SERVER; @@ -1178,7 +1177,7 @@ prlsdkGetSerialInfo(PRL_HANDLE serialPort, virDomainC= hrDef *chr) chr->source->type =3D VIR_DOMAIN_CHR_TYPE_UDP; uristr =3D g_strdup_printf("udp://%s", friendlyName); if (!(uri =3D virURIParse(uristr))) - goto cleanup; + return -1; chr->source->data.udp.bindHost =3D g_strdup(uri->server); chr->source->data.udp.bindService =3D g_strdup_printf("%d", uri->p= ort); chr->source->data.udp.connectHost =3D g_strdup(uri->server); @@ -1187,17 +1186,10 @@ prlsdkGetSerialInfo(PRL_HANDLE serialPort, virDomai= nChrDef *chr) default: virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown serial type: %X"), emulatedType); - goto cleanup; - break; + return -1; } =20 - ret =3D 0; - - cleanup: - VIR_FREE(friendlyName); - VIR_FREE(uristr); - - return ret; + return 0; } =20 =20 --=20 2.34.1 From nobody Fri May 17 02:41:17 2024 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1655876147; cv=none; d=zohomail.com; s=zohoarc; b=i1pmQKl3MZwVbDmLx7zxTgjoiCmqvoFkSWcaJshQ7QZ/SrrgdhBGJlgAfAMZ0eSqzKJg271v2DWxf7cIYCTGaZuJyKIA+3NSl13bOSWcasRVdTgW8yab+5ATp+OnCAY5j2yz3pxM1GsGP0YwugwPy2g6jSyR7fzH4My3x5Paz64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655876147; h=Content-Type:Content-Transfer-Encoding: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=Q0vMUdERQFLj4f1O5piDhcfOtyYOfWJKxur9zwH+u+U=; b=ghkyH1jPIyZFsXZV1wO1kd20cgIPaIFa18XL7XOB98g1AKJ1xoD1j2/xODIaN9WOVB0Po2rgJd/JgYS6TentzKhyfnu+2IpnNmPStUE/7P9XfCU7ysWfybgJ4LKa65EFw5t4vhj9EfOVBtl3BpDfayysbpWLgBpEoNdQ8N3SNAc= 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=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.133.124]) by mx.zohomail.com with SMTPS id 1655876147265456.3961746976321; Tue, 21 Jun 2022 22:35:47 -0700 (PDT) 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-84-3XfbO2knNNGuhOL-7nzIiw-1; Wed, 22 Jun 2022 01:35:43 -0400 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 CA62A81F46D; Wed, 22 Jun 2022 05:35: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 B5C1F2026D64; Wed, 22 Jun 2022 05:35:41 +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 6A131194704C; Wed, 22 Jun 2022 05:35:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C00761947042 for ; Wed, 22 Jun 2022 05:35:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A20A1112131E; Wed, 22 Jun 2022 05:35:38 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 499D11121314 for ; Wed, 22 Jun 2022 05:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655876146; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Q0vMUdERQFLj4f1O5piDhcfOtyYOfWJKxur9zwH+u+U=; b=YL84TXrqrqesk+3yS2xUK0YajB79jomhw9f3cv0Tx/2XPkX+d4Ix0RLFH3EUq/ttHS6bGj pm3Y2g8q11R+LtHgRh4MORll1eRw3863zg/RC2B1YzJ5GBekAZJsaBZeftAa7FMkutJriu oBYZ/Er6Yx6UEvx7ZBZtMai7Pc+00vM= X-MC-Unique: 3XfbO2knNNGuhOL-7nzIiw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/6] vmx: use g_autofree in virVMXParseSerial Date: Wed, 22 Jun 2022 07:35:32 +0200 Message-Id: <462c40006bea33947f2109d1396e7e5255eae4aa.1655876067.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1655876148082100007 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Pavel Hrdina --- src/vmx/vmx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 282e9562e0..43ddee5bb6 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2895,13 +2895,13 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf= , int port, bool startConnected =3D false; =20 char fileType_name[48] =3D ""; - char *fileType =3D NULL; + g_autofree char *fileType =3D NULL; =20 char fileName_name[48] =3D ""; - char *fileName =3D NULL; + g_autofree char *fileName =3D NULL; =20 char network_endPoint_name[48] =3D ""; - char *network_endPoint =3D NULL; + g_autofree char *network_endPoint =3D NULL; =20 g_autoptr(virURI) parsedUri =3D NULL; =20 @@ -3048,10 +3048,6 @@ virVMXParseSerial(virVMXContext *ctx, virConf *conf,= int port, g_clear_pointer(def, virDomainChrDefFree); } =20 - VIR_FREE(fileType); - VIR_FREE(fileName); - VIR_FREE(network_endPoint); - return result; } =20 --=20 2.34.1 From nobody Fri May 17 02:41:17 2024 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1655876145; cv=none; d=zohomail.com; s=zohoarc; b=cMq+EAPytzAVAQKsu7k4Du9JkSEIpyCi0MhDNUBnLWqMxqAKoUuzoE0IEzV9xlCZC+/09e9PaInega/lEJC/J0PBGlRcycTWCWvHkkSxkLnBwXFBKbhCPozo2mAcUHJuTV97B+RmPnlKG+S2Fo2sNABvEDVhd4PjWA2h3QAOIr0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655876145; h=Content-Type:Content-Transfer-Encoding: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=/w+kQRh9TtRJ/icG3vYdSoBAHqsY/QxI885R0YymqQs=; b=GrOSC/qtr8BNwXe2LoGMamsL0Inv5/0F2eRFfXhG6i9stjsZ8L3JtYNE3ld4Ctl6M2oz43TxPrlx2TY2Iw3SBD83txOT32Or+17lfbDte+TKyhCfu/mdHRnEn2tYGfxZgu0Sezcy+hDSUzfczB9gv4NUYdXV0sCV2bTQWJDPEIs= 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=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.133.124]) by mx.zohomail.com with SMTPS id 1655876145821657.17445678932; Tue, 21 Jun 2022 22:35:45 -0700 (PDT) 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-504-sX7hOjc5PHKk654Zo_Qsdg-1; Wed, 22 Jun 2022 01:35:43 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3628B296A606; Wed, 22 Jun 2022 05:35: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 228A440D0160; Wed, 22 Jun 2022 05:35:41 +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 7C16A1947054; Wed, 22 Jun 2022 05:35:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5B2321947042 for ; Wed, 22 Jun 2022 05:35:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 405621121315; Wed, 22 Jun 2022 05:35:39 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id DAE831121314 for ; Wed, 22 Jun 2022 05:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655876144; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/w+kQRh9TtRJ/icG3vYdSoBAHqsY/QxI885R0YymqQs=; b=ECt192+kuvQibVG1V6lcAQ6HDfWc86z8xKEBtPYsQ3o4WHcW562UlS8wsS8JWEOJRMFQyA lSceoxGft9bogOngiDIws+RM4R9BEYBU1sZJeNlw/goW8XIq7xjXkz/yhJiWr+6NwO9qdR zzDajqz8PXDecE3r92gwLJvfu7li7KE= X-MC-Unique: sX7hOjc5PHKk654Zo_Qsdg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 5/6] qemu: remove cleanup label from qemuMigrationSrcGraphicsRelocate Date: Wed, 22 Jun 2022 07:35:33 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1655876146108100002 Remove the label and use 'rc' instead of 'ret'. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Pavel Hrdina --- src/qemu/qemu_migration.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 3d7d5efda3..0ed0066e27 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2104,7 +2104,6 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriver *drive= r, const char *graphicsuri) { qemuDomainObjPrivate *priv =3D vm->privateData; - int ret =3D -1; const char *listenAddress =3D NULL; virSocketAddr addr; g_autoptr(virURI) uri =3D NULL; @@ -2112,12 +2111,13 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriver *dri= ver, int port =3D -1; int tlsPort =3D -1; const char *tlsSubject =3D NULL; + int rc =3D -1; =20 if (!cookie || (!cookie->graphics && !graphicsuri)) return 0; =20 if (graphicsuri && !(uri =3D virURIParse(graphicsuri))) - goto cleanup; + return -1; =20 if (cookie->graphics) { type =3D cookie->graphics->type; @@ -2140,7 +2140,7 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriver *drive= r, if ((type =3D virDomainGraphicsTypeFromString(uri->scheme)) < 0) { virReportError(VIR_ERR_INVALID_ARG, _("unknown graphics type %s"), uri->scheme); - goto cleanup; + return -1; } =20 if (uri->server) @@ -2156,7 +2156,7 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriver *drive= r, virReportError(VIR_ERR_INVALID_ARG, _("invalid tlsPort number: %s"), param->value); - goto cleanup; + return -1; } } else if (STRCASEEQ(param->name, "tlsSubject")) { tlsSubject =3D param->value; @@ -2167,32 +2167,27 @@ qemuMigrationSrcGraphicsRelocate(virQEMUDriver *dri= ver, /* QEMU doesn't support VNC relocation yet, so * skip it to avoid generating an error */ - if (type !=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { - ret =3D 0; - goto cleanup; - } + if (type !=3D VIR_DOMAIN_GRAPHICS_TYPE_SPICE) + return 0; =20 /* Older libvirt sends port =3D=3D 0 for listen type=3D'none' graphics= . It's * safe to ignore such requests since relocation to unknown port does * not make sense in general. */ - if (port <=3D 0 && tlsPort <=3D 0) { - ret =3D 0; - goto cleanup; - } + if (port <=3D 0 && tlsPort <=3D 0) + return 0; =20 if (qemuDomainObjEnterMonitorAsync(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT) =3D=3D= 0) { qemuDomainJobPrivate *jobPriv =3D priv->job.privateData; =20 - ret =3D qemuMonitorGraphicsRelocate(priv->mon, type, listenAddress, + rc =3D qemuMonitorGraphicsRelocate(priv->mon, type, listenAddress, port, tlsPort, tlsSubject); - jobPriv->spiceMigration =3D !ret; + jobPriv->spiceMigration =3D !rc; qemuDomainObjExitMonitor(vm); } =20 - cleanup: - return ret; + return rc; } =20 =20 --=20 2.34.1 From nobody Fri May 17 02:41:17 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=1655876224; cv=none; d=zohomail.com; s=zohoarc; b=CqelKiLKIJ2+YJ60HnEGvwTXdBONV/t0AC3DZP1e67EqspRpKRG8oyIEt3w4j0td7VOzpbrG62Kkfd1i2GzMqIWKKTECXlPztvr6NmNyZyLdAn0HpNaTl0fUh4OKlifxhtNb9QPgjYEo9AxQTPOxT4K8psR/NM1cu7SdTGqgAXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655876224; h=Content-Type:Content-Transfer-Encoding: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=Rb6IBKoxMwdIzibXWBd79nTb2l6exWWMuQB2hiDBnpo=; b=ZpTpY7j/l51E6Ny1MOvTJR2BiVbuaPKGFoUfylV/lpPqinEF0sDGeFo9tC/oorCDfLJJ/+DvmE+Up0r5a3atZ020h86DvltTc/yjwuQK12O+DTBNJUli6zHi8bDsWCMXKk8xlgJp1nbKD6+GD7pe7zC/Zm9/KWkm209tpt5VMfc= 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 1655876224883866.7514649524365; Tue, 21 Jun 2022 22:37:04 -0700 (PDT) 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-49-Evq5N6pjNEyOOt5uA5ItcQ-1; Wed, 22 Jun 2022 01:35:46 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1FFFA85A58A; Wed, 22 Jun 2022 05:35:43 +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 0A69E1121315; Wed, 22 Jun 2022 05:35:43 +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 E3690194704A; Wed, 22 Jun 2022 05:35:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DF1561947055 for ; Wed, 22 Jun 2022 05:35:39 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D115E1121315; Wed, 22 Jun 2022 05:35:39 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7864E1121314 for ; Wed, 22 Jun 2022 05:35:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655876223; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Rb6IBKoxMwdIzibXWBd79nTb2l6exWWMuQB2hiDBnpo=; b=AJTDPMoJ9GvrDw54z5lBH2U8945+Hi+xKb48UTPt33m9cLTfBW/smfn48/8cT2zKLjglqh uu/yOBhK8DBG2qj1oqqHFDsSq4EVpz5OINvopRdbliJpWGknHfKN//bLClD50uEHHJsAfx 9JsiAo7fjX4Vh+oKKT4BZMNaFj0Ycxk= X-MC-Unique: Evq5N6pjNEyOOt5uA5ItcQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 6/6] libxl: remove cleanup label from libxlDomainMigrationSrcPerform Date: Wed, 22 Jun 2022 07:35:34 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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 2.78 on 10.11.54.3 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1655876226730100001 Use VIR_AUTOCLOSE for the remaining file descriptor that uses manual cleanup and remove the label. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Pavel Hrdina --- src/libxl/libxl_migration.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index c5ec80139f..800a6b0365 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -1183,13 +1183,13 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *= driver, char portstr[100]; g_autoptr(virURI) uri =3D NULL; virNetSocket *sock; - int sockfd =3D -1; + VIR_AUTOCLOSE sockfd =3D -1; int ret =3D -1; =20 /* parse dst host:port from uri */ uri =3D virURIParse(uri_str); if (uri =3D=3D NULL || uri->server =3D=3D NULL || uri->port =3D=3D 0) - goto cleanup; + return -1; =20 hostname =3D uri->server; port =3D uri->port; @@ -1199,11 +1199,11 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *= driver, if (virNetSocketNewConnectTCP(hostname, portstr, AF_UNSPEC, &sock) < 0) - goto cleanup; + return -1; =20 if (virNetSocketSetBlocking(sock, true) < 0) { virObjectUnref(sock); - goto cleanup; + return -1; } =20 sockfd =3D virNetSocketDupFD(sock, true); @@ -1229,8 +1229,6 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *dr= iver, libxlDomainObjEndJob(driver, vm); } =20 - cleanup: - VIR_FORCE_CLOSE(sockfd); return ret; } =20 --=20 2.34.1