]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nwfilter: Clean up a couple nwfilter_driver error paths
authorJohn Ferlan <jferlan@redhat.com>
Sun, 14 May 2017 12:57:13 +0000 (08:57 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Sun, 16 Jul 2017 03:00:30 +0000 (23:00 -0400)
No need to goto cleanup and check "if (obj)" if we know (obj) isn't there,
so just return immediately.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/nwfilter/nwfilter_driver.c

index 5e620234ecd3fa18ff84bc3eabdc2f0a96d04872..59d01b452c3a0d7af2ad85e09735a0366ecd8108 100644 (file)
@@ -391,7 +391,7 @@ nwfilterLookupByUUID(virConnectPtr conn,
     nwfilterDriverUnlock();
 
     if (!obj)
-        goto cleanup;
+        return NULL;
     def = virNWFilterObjGetDef(obj);
 
     if (virNWFilterLookupByUUIDEnsureACL(conn, def) < 0)
@@ -400,8 +400,7 @@ nwfilterLookupByUUID(virConnectPtr conn,
     ret = virGetNWFilter(conn, def->name, def->uuid);
 
  cleanup:
-    if (obj)
-        virNWFilterObjUnlock(obj);
+    virNWFilterObjUnlock(obj);
     return ret;
 }
 
@@ -421,7 +420,7 @@ nwfilterLookupByName(virConnectPtr conn,
     if (!obj) {
         virReportError(VIR_ERR_NO_NWFILTER,
                        _("no nwfilter with matching name '%s'"), name);
-        goto cleanup;
+        return NULL;
     }
     def = virNWFilterObjGetDef(obj);
 
@@ -431,8 +430,7 @@ nwfilterLookupByName(virConnectPtr conn,
     ret = virGetNWFilter(conn, def->name, def->uuid);
 
  cleanup:
-    if (obj)
-        virNWFilterObjUnlock(obj);
+    virNWFilterObjUnlock(obj);
     return ret;
 }
 
@@ -594,7 +592,7 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter,
     nwfilterDriverUnlock();
 
     if (!obj)
-        goto cleanup;
+        return NULL;
     def = virNWFilterObjGetDef(obj);
 
     if (virNWFilterGetXMLDescEnsureACL(nwfilter->conn, def) < 0)
@@ -603,8 +601,7 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter,
     ret = virNWFilterDefFormat(def);
 
  cleanup:
-    if (obj)
-        virNWFilterObjUnlock(obj);
+    virNWFilterObjUnlock(obj);
     return ret;
 }