summaryrefslogtreecommitdiff
path: root/src/libnet_init.c
diff options
context:
space:
mode:
authorJoachim Nilsson <troglobit@gmail.com>2019-10-08 20:31:51 +0200
committerJoachim Nilsson <troglobit@gmail.com>2019-10-08 20:31:51 +0200
commit1efb8be5ec6468afe52479f9d0bafda4239aa35f (patch)
tree02a86165e0058e6c6b60f204735486006f92125e /src/libnet_init.c
parent1a476db0b3b538d70d11c09339ac388628f70d27 (diff)
downloadlibnet-1efb8be5ec6468afe52479f9d0bafda4239aa35f.tar.gz
libnet_destroy(): Don't close() l->fd if -1
Found by Valgrind Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Diffstat (limited to 'src/libnet_init.c')
-rw-r--r--src/libnet_init.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libnet_init.c b/src/libnet_init.c
index af52023..4a20c73 100644
--- a/src/libnet_init.c
+++ b/src/libnet_init.c
@@ -121,7 +121,8 @@ libnet_destroy(libnet_t *l)
{
if (l)
{
- close(l->fd);
+ if (l->fd != -1)
+ close(l->fd);
free(l->device);
libnet_clear_packet(l);
free(l);