]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libvirt-domain.c: modernize virDomainMigrateCheckNotLocal()
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 13 Jul 2020 09:49:33 +0000 (06:49 -0300)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 13 Jul 2020 15:17:27 +0000 (17:17 +0200)
Use g_autoptr() and remove the 'cleanup' label.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/libvirt-domain.c

index 9f65cba2e87a6a086011bddad2183f164f29ea3f..0941caa67f75b0f2f56ef283204f7d568c337fb6 100644 (file)
@@ -3286,22 +3286,17 @@ virDomainMigrateVersion3Params(virDomainPtr domain,
 static int
 virDomainMigrateCheckNotLocal(const char *dconnuri)
 {
-    virURIPtr tempuri = NULL;
-    int ret = -1;
+    g_autoptr(virURI) tempuri = NULL;
 
     if (!(tempuri = virURIParse(dconnuri)))
-        goto cleanup;
+        return -1;
     if (!tempuri->server || STRPREFIX(tempuri->server, "localhost")) {
         virReportInvalidArg(dconnuri, "%s",
                             _("Attempt to migrate guest to the same host"));
-        goto cleanup;
+        return -1;
     }
 
-    ret = 0;
-
- cleanup:
-    virURIFree(tempuri);
-    return ret;
+    return 0;
 }