From: Liao Pingfang <liao.pingfang@xxxxxxxxxx> According to the context, here we are checking net->downscript's validity, Signed-off-by: Liao Pingfang <liao.pingfang@xxxxxxxxxx> --- src/qemu/qemu_hotplug.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index d1a2be1..8c99dfc 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4672,9 +4672,8 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver, virDomainNetReleaseActualDevice(conn, vm->def, net); else VIR_WARN("Unable to release network device '%s'", NULLSTR(net->ifname)); - } else if (net->type == VIR_DOMAIN_NET_TYPE_ETHERNET) { - if (net->script) - virNetDevRunEthernetScript(net->ifname, net->downscript); + } else if (net->type == VIR_DOMAIN_NET_TYPE_ETHERNET && net->downscript) { + virNetDevRunEthernetScript(net->ifname, net->downscript); } virDomainNetDefFree(net); return 0; -- 2.9.5