summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/devices/tap/tap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index 6ad01770cf0..aa9182a58f7 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -109,8 +109,11 @@ tap_free (vlib_main_t * vm, virtio_if_t * vif)
virtio_vring_free_tx (vm, vif, TX_QUEUE (i));
/* *INDENT-ON* */
- _IOCTL (vif->tap_fds[0], TUNSETPERSIST, (void *) (uintptr_t) 0);
- tap_log_dbg (vif, "TUNSETPERSIST: unset");
+ if (vif->tap_fds)
+ {
+ _IOCTL (vif->tap_fds[0], TUNSETPERSIST, (void *) (uintptr_t) 0);
+ tap_log_dbg (vif, "TUNSETPERSIST: unset");
+ }
error:
vec_foreach_index (i, vif->tap_fds) close (vif->tap_fds[i]);