diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-04-14 10:59:57 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2005-04-14 10:59:57 +0000 |
commit | 88c7b68e5e449f93a96c767c2fdba36b11c07ea6 (patch) | |
tree | a3713b8cca96f26ec839295ff5a6d1400060992d | |
parent | eafa624f46551272141373350a458681a3641c0f (diff) |
fix possible double free(), thans to Andrey Matveev
-rw-r--r-- | usr.sbin/hostapd/hostapd.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.sbin/hostapd/hostapd.c b/usr.sbin/hostapd/hostapd.c index 9280816e5c5..4040dd070bd 100644 --- a/usr.sbin/hostapd/hostapd.c +++ b/usr.sbin/hostapd/hostapd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hostapd.c,v 1.8 2005/04/13 21:15:36 reyk Exp $ */ +/* $OpenBSD: hostapd.c,v 1.9 2005/04/14 10:59:56 reyk Exp $ */ /* * Copyright (c) 2004, 2005 Reyk Floeter <reyk@vantronix.net> @@ -138,18 +138,16 @@ hostapd_bpf_open(u_int flags) if (asprintf(&dev, "/dev/bpf%u", i) == -1) hostapd_fatal("failed to allocate buffer\n"); - if ((fd = open(dev, flags)) != -1) + if ((fd = open(dev, flags)) != -1) { + free(dev); break; + } free(dev); } - if (fd == -1) { - free(dev); + if (fd == -1) hostapd_fatal("unable to open BPF device\n"); - } - - free(dev); /* * Get and validate the BPF version |