mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
memory: Tighten up some memory handling to help spot errors
Set pointers to NULL after free() to help force out memory handling errors. Add some extra memory / resource tracking to try and chase out latent bugs / leaks Fixed a couple of memory traces that were misreporting. Signed-off-by: Ian Clowes <clowes_ian@hotmail.com>
This commit is contained in:
parent
4df0c986f1
commit
6bf9b6df9a
10 changed files with 202 additions and 75 deletions
|
|
@ -24,11 +24,6 @@ int get_bandwidth(const char *ifname, struct dawn_mac client_addr, float *rx_rat
|
|||
int compare_essid_iwinfo(struct dawn_mac bssid_addr, struct dawn_mac bssid_addr_to_compare) {
|
||||
const struct iwinfo_ops *iw;
|
||||
|
||||
char mac_buf[20];
|
||||
char mac_buf_to_compare[20];
|
||||
sprintf(mac_buf, MACSTR, MAC2STR(bssid_addr.u8));
|
||||
sprintf(mac_buf_to_compare, MACSTR, MAC2STR(bssid_addr_to_compare.u8));
|
||||
|
||||
DIR *dirp;
|
||||
struct dirent *entry;
|
||||
dirp = opendir(hostapd_dir_glob); // error handling?
|
||||
|
|
@ -50,11 +45,15 @@ int compare_essid_iwinfo(struct dawn_mac bssid_addr, struct dawn_mac bssid_addr_
|
|||
|
||||
iw = iwinfo_backend(entry->d_name);
|
||||
|
||||
// FIXME: Try to reduce string conversion and comparison here by using byte array compares
|
||||
// TODO: Magic number
|
||||
static char buf_bssid[18] = {0};
|
||||
if (iw->bssid(entry->d_name, buf_bssid))
|
||||
snprintf(buf_bssid, sizeof(buf_bssid), "00:00:00:00:00:00");
|
||||
|
||||
char mac_buf[20];
|
||||
sprintf(mac_buf, MACSTR, MAC2STR(bssid_addr.u8));
|
||||
|
||||
if (strcmp(mac_buf, buf_bssid) == 0) {
|
||||
|
||||
if (iw->ssid(entry->d_name, buf_essid))
|
||||
|
|
@ -62,6 +61,9 @@ int compare_essid_iwinfo(struct dawn_mac bssid_addr, struct dawn_mac bssid_addr_
|
|||
essid = buf_essid;
|
||||
}
|
||||
|
||||
char mac_buf_to_compare[20];
|
||||
sprintf(mac_buf_to_compare, MACSTR, MAC2STR(bssid_addr_to_compare.u8));
|
||||
|
||||
if (strcmp(mac_buf_to_compare, buf_bssid) == 0) {
|
||||
if (iw->ssid(entry->d_name, buf_essid_to_compare))
|
||||
memset(buf_essid_to_compare, 0, sizeof(buf_essid_to_compare));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue