mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
util: midonet: use g_auto for virCommand
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
a269fae099
commit
aa9cd08d92
@ -39,8 +39,7 @@ int
|
||||
virNetDevMidonetBindPort(const char *ifname,
|
||||
const virNetDevVPortProfile *virtualport)
|
||||
{
|
||||
int ret = -1;
|
||||
virCommand *cmd = NULL;
|
||||
g_autoptr(virCommand) cmd = NULL;
|
||||
char virtportuuid[VIR_UUID_STRING_BUFLEN];
|
||||
|
||||
virUUIDFormat(virtualport->interfaceID, virtportuuid);
|
||||
@ -53,13 +52,10 @@ virNetDevMidonetBindPort(const char *ifname,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to bind port %s to the virtual port %s"),
|
||||
ifname, virtportuuid);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virCommandFree(cmd);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,8 +69,7 @@ virNetDevMidonetBindPort(const char *ifname,
|
||||
int
|
||||
virNetDevMidonetUnbindPort(const virNetDevVPortProfile *virtualport)
|
||||
{
|
||||
int ret = -1;
|
||||
virCommand *cmd = NULL;
|
||||
g_autoptr(virCommand) cmd = NULL;
|
||||
char virtportuuid[VIR_UUID_STRING_BUFLEN];
|
||||
|
||||
virUUIDFormat(virtualport->interfaceID, virtportuuid);
|
||||
@ -86,11 +81,8 @@ virNetDevMidonetUnbindPort(const virNetDevVPortProfile *virtualport)
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to unbind the virtual port %s from Midonet"),
|
||||
virtportuuid);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virCommandFree(cmd);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user