summaryrefslogtreecommitdiffstats
path: root/if-bsd.c
diff options
context:
space:
mode:
authorroy@uberlaptop.marples.name <roy@uberlaptop.marples.name>2012-03-27 16:30:33 +0000
committerroy@uberlaptop.marples.name <roy@uberlaptop.marples.name>2012-03-27 16:30:33 +0000
commitdcc1e564e7930b2425958560e108bca55a639b35 (patch)
tree6f0db46a9456927bcb5e201f84dd9bb1f14fc468 /if-bsd.c
parent9cf974fea3154a9b3fd90e77970f6d86f2669e51 (diff)
downloaddhcpcd-dcc1e564e7930b2425958560e108bca55a639b35.tar.xz
Fix some valgrind errors on FreeBSD
Diffstat (limited to 'if-bsd.c')
-rw-r--r--if-bsd.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/if-bsd.c b/if-bsd.c
index c959b5e4..af98863c 100644
--- a/if-bsd.c
+++ b/if-bsd.c
@@ -90,6 +90,15 @@ if_conf(_unused struct interface *iface)
return 0;
}
+#ifdef DEBUG_MEMORY
+static void
+cleanup(void)
+{
+
+ free(link_buf);
+}
+#endif
+
int
init_sockets(void)
{
@@ -129,6 +138,7 @@ getifssid(const char *ifname, char *ssid)
strlcpy(ireq.i_name, ifname, sizeof(ireq.i_name));
ireq.i_type = IEEE80211_IOC_SSID;
ireq.i_val = -1;
+ memset(nwid, 0, sizeof(nwid));
ireq.i_data = &nwid;
if (ioctl(socket_afnet, SIOCG80211, &ireq) == 0) {
retval = ireq.i_len;
@@ -267,6 +277,11 @@ open_link_socket(void)
{
int fd;
+#ifdef DEBUG_MEMORY
+ if (link_buf == NULL)
+ atexit(cleanup);
+#endif
+
fd = socket(PF_ROUTE, SOCK_RAW, 0);
if (fd != -1) {
set_cloexec(fd);