[libvirt] [PATCH 2/2] openvz: Clean up openvzDomainGetHostname

John Ferlan posted 2 patches 7 years, 1 month ago
[libvirt] [PATCH 2/2] openvz: Clean up openvzDomainGetHostname
Posted by John Ferlan 7 years, 1 month ago
Remove the unnecessary goto error followed by goto cleanup
processing.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/openvz/openvz_driver.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index ec9541840a..2c62dd6f29 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -319,22 +319,18 @@ openvzDomainGetHostname(virDomainPtr dom, unsigned int flags)
 
     hostname = openvzVEGetStringParam(dom, "hostname");
     if (hostname == NULL)
-        goto error;
+        goto cleanup;
 
     /* vzlist prints an unset hostname as '-' */
     if (STREQ(hostname, "-")) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("Hostname of '%s' is unset"), vm->def->name);
-        goto error;
+        VIR_FREE(hostname);
     }
 
  cleanup:
     virDomainObjEndAPI(&vm);
     return hostname;
-
- error:
-    VIR_FREE(hostname);
-    goto cleanup;
 }
 
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] openvz: Clean up openvzDomainGetHostname
Posted by Ján Tomko 7 years ago
On Wed, Apr 11, 2018 at 12:57:08PM -0400, John Ferlan wrote:
>Remove the unnecessary goto error followed by goto cleanup
>processing.
>
>Signed-off-by: John Ferlan <jferlan@redhat.com>
>---
> src/openvz/openvz_driver.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list