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(a)redhat.com>
---
src/nwfilter/nwfilter_driver.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index c740c53..d527769 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -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;
}
@@ -595,7 +593,7 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter,
nwfilterDriverUnlock();
if (!obj)
- goto cleanup;
+ return NULL;
def = virNWFilterObjGetDef(obj);
if (virNWFilterGetXMLDescEnsureACL(nwfilter->conn, def) < 0)
@@ -604,8 +602,7 @@ nwfilterGetXMLDesc(virNWFilterPtr nwfilter,
ret = virNWFilterDefFormat(def);
cleanup:
- if (obj)
- virNWFilterObjUnlock(obj);
+ virNWFilterObjUnlock(obj);
return ret;
}
--
2.9.4