Avoid deleting NULL veth device name

If veth device allocation has a fatal error, the veths
array may contain NULL device names. Avoid calling the
virNetDevVethDelete function on such names.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-10-02 11:26:59 +01:00
parent 10caf94ddc
commit 8766e9b5a5

View File

@ -1290,7 +1290,7 @@ cleanup:
rc = -1;
}
for (i = 0; i < nveths; i++) {
if (rc != 0)
if (rc != 0 && veths[i])
ignore_value(virNetDevVethDelete(veths[i]));
VIR_FREE(veths[i]);
}