summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bsd/tun.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/bsd/tun.c b/src/bsd/tun.c
index ed3eb27..f193668 100644
--- a/src/bsd/tun.c
+++ b/src/bsd/tun.c
@@ -141,8 +141,10 @@ int tun_init(tun_device_t* dev, const char* dev_name, const char* dev_type, cons
}
int ret = tun_init_post(dev);
- if(ret)
+ if(ret) {
+ tun_close(dev);
return ret;
+ }
if(ifcfg_addr)
tun_do_ifconfig(dev);