openvz: Clean up openvzDomainGetHostname

Remove the unnecessary goto error followed by goto cleanup
processing.

Signed-off-by: John Ferlan <jferlan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
John Ferlan 2018-03-30 10:04:54 -04:00
parent 369e5a828f
commit ee11ba29f5

View File

@ -319,22 +319,18 @@ openvzDomainGetHostname(virDomainPtr dom, unsigned int flags)
hostname = openvzVEGetStringParam(dom, "hostname"); hostname = openvzVEGetStringParam(dom, "hostname");
if (hostname == NULL) if (hostname == NULL)
goto error; goto cleanup;
/* vzlist prints an unset hostname as '-' */ /* vzlist prints an unset hostname as '-' */
if (STREQ(hostname, "-")) { if (STREQ(hostname, "-")) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Hostname of '%s' is unset"), vm->def->name); _("Hostname of '%s' is unset"), vm->def->name);
goto error; VIR_FREE(hostname);
} }
cleanup: cleanup:
virDomainObjEndAPI(&vm); virDomainObjEndAPI(&vm);
return hostname; return hostname;
error:
VIR_FREE(hostname);
goto cleanup;
} }