]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Use os_* wrapper more consistently
authorJouni Malinen <j@w1.fi>
Tue, 23 Jun 2015 17:04:14 +0000 (20:04 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 23 Jun 2015 17:08:00 +0000 (20:08 +0300)
os_free() needs to be used when freeing memory that was allocated with
os_malloc()/os_zalloc()/os_calloc().

Signed-off-by: Jouni Malinen <j@w1.fi>
src/drivers/driver_atheros.c
src/drivers/driver_hostap.c

index aaada0a45a7640db29b8409f1961d43cdfaf28a7..b721c3239d04bcc798e8e8326f5d7dabec1bbdcb 100644 (file)
@@ -1682,8 +1682,7 @@ bad:
                l2_packet_deinit(drv->sock_xmit);
        if (drv->ioctl_sock >= 0)
                close(drv->ioctl_sock);
-       if (drv != NULL)
-               free(drv);
+       os_free(drv);
        return NULL;
 }
 
@@ -1711,7 +1710,7 @@ atheros_deinit(void *priv)
                l2_packet_deinit(drv->sock_xmit);
        if (drv->sock_raw)
                l2_packet_deinit(drv->sock_raw);
-       free(drv);
+       os_free(drv);
 }
 
 static int
index 14c52d2ca837eff0f82f38e48d621b2a10462560..88350052a6b2463fe0957a57ec07b1168bc6a594 100644 (file)
@@ -322,7 +322,7 @@ static int hostap_send_eapol(void *priv, const u8 *addr, const u8 *data,
                           "failed: %d (%s)",
                           (unsigned long) len, errno, strerror(errno));
        }
-       free(hdr);
+       os_free(hdr);
 
        return res;
 }
@@ -471,18 +471,18 @@ static int hostap_get_seqnum(const char *ifname, void *priv, const u8 *addr,
        param = (struct prism2_hostapd_param *) buf;
        param->cmd = PRISM2_GET_ENCRYPTION;
        if (addr == NULL)
-               memset(param->sta_addr, 0xff, ETH_ALEN);
+               os_memset(param->sta_addr, 0xff, ETH_ALEN);
        else
-               memcpy(param->sta_addr, addr, ETH_ALEN);
+               os_memcpy(param->sta_addr, addr, ETH_ALEN);
        param->u.crypt.idx = idx;
 
        if (hostapd_ioctl(drv, param, blen)) {
                printf("Failed to get encryption.\n");
                ret = -1;
        } else {
-               memcpy(seq, param->u.crypt.seq, 8);
+               os_memcpy(seq, param->u.crypt.seq, 8);
        }
-       free(buf);
+       os_free(buf);
 
        return ret;
 }