mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Free cmd in virNetDevVethDelete
Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
This commit is contained in:
parent
7dc1d4ab89
commit
524b21979a
@ -196,18 +196,24 @@ int virNetDevVethDelete(const char *veth)
|
|||||||
{
|
{
|
||||||
virCommandPtr cmd = virCommandNewArgList("ip", "link", "del", veth, NULL);
|
virCommandPtr cmd = virCommandNewArgList("ip", "link", "del", veth, NULL);
|
||||||
int status;
|
int status;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
if (virCommandRun(cmd, &status) < 0)
|
if (virCommandRun(cmd, &status) < 0)
|
||||||
return -1;
|
goto cleanup;
|
||||||
|
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
if (!virNetDevExists(veth)) {
|
if (!virNetDevExists(veth)) {
|
||||||
VIR_DEBUG("Device %s already deleted (by kernel namespace cleanup)", veth);
|
VIR_DEBUG("Device %s already deleted (by kernel namespace cleanup)", veth);
|
||||||
return 0;
|
ret = 0;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Failed to delete veth device %s"), veth);
|
_("Failed to delete veth device %s"), veth);
|
||||||
return -1;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
ret = 0;
|
||||||
|
cleanup:
|
||||||
|
virCommandFree(cmd);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user