aboutsummaryrefslogtreecommitdiff
path: root/lib/libpfctl/libpfctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libpfctl/libpfctl.c')
-rw-r--r--lib/libpfctl/libpfctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index e747763ae6ef..3db596d6fd38 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -76,7 +76,6 @@ pfctl_open(const char *pf_device)
struct pfctl_handle *h;
h = calloc(1, sizeof(struct pfctl_handle));
- h->fd = -1;
h->fd = open(pf_device, O_RDWR);
if (h->fd < 0)
@@ -87,7 +86,8 @@ pfctl_open(const char *pf_device)
return (h);
error:
- close(h->fd);
+ if (h->fd != -1)
+ close(h->fd);
snl_free(&h->ss);
free(h);