]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libxl: remove cleanup label from libxlDomainMigrationSrcPerform
authorJán Tomko <jtomko@redhat.com>
Wed, 22 Jun 2022 05:32:42 +0000 (07:32 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 22 Jun 2022 10:28:29 +0000 (12:28 +0200)
Use VIR_AUTOCLOSE for the remaining file descriptor that uses
manual cleanup and remove the label.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/libxl/libxl_migration.c

index c5ec80139facfa2af0b1e00069cd502d519353da..800a6b03659d6fce97324a5108001c78d8e29a76 100644 (file)
@@ -1183,13 +1183,13 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *driver,
     char portstr[100];
     g_autoptr(virURI) uri = NULL;
     virNetSocket *sock;
-    int sockfd = -1;
+    VIR_AUTOCLOSE sockfd = -1;
     int ret = -1;
 
     /* parse dst host:port from uri */
     uri = virURIParse(uri_str);
     if (uri == NULL || uri->server == NULL || uri->port == 0)
-        goto cleanup;
+        return -1;
 
     hostname = uri->server;
     port = uri->port;
@@ -1199,11 +1199,11 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *driver,
     if (virNetSocketNewConnectTCP(hostname, portstr,
                                   AF_UNSPEC,
                                   &sock) < 0)
-        goto cleanup;
+        return -1;
 
     if (virNetSocketSetBlocking(sock, true) < 0) {
         virObjectUnref(sock);
-        goto cleanup;
+        return -1;
     }
 
     sockfd = virNetSocketDupFD(sock, true);
@@ -1229,8 +1229,6 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *driver,
         libxlDomainObjEndJob(driver, vm);
     }
 
- cleanup:
-    VIR_FORCE_CLOSE(sockfd);
     return ret;
 }