aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2014-04-05 17:39:56 (GMT)
committerJouni Malinen <j@w1.fi>2014-04-05 17:42:12 (GMT)
commit5784b9a41b49e39eb0701f636961521dd687dea6 (patch)
treebe3b410eb9a2c31bff7702c051e0d4945049ec83 /hostapd
parent7b7328e3cd169f5ba110d045b33455f7b3192e25 (diff)
downloadhostap-5784b9a41b49e39eb0701f636961521dd687dea6.zip
hostap-5784b9a41b49e39eb0701f636961521dd687dea6.tar.gz
hostap-5784b9a41b49e39eb0701f636961521dd687dea6.tar.bz2
Fix memory leaks in hostapd configuration updates
Some of the allocated configuration parameter did not free the previous value if a configuration file or ctrl_iface SET command updated a previously set value. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/config_file.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 26e64fa..6ad1ca7 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2049,6 +2049,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
#endif /* EAP_SERVER */
} else if (os_strcmp(buf, "eap_message") == 0) {
char *term;
+ os_free(bss->eap_req_id_text);
bss->eap_req_id_text = os_strdup(pos);
if (bss->eap_req_id_text == NULL) {
wpa_printf(MSG_ERROR, "Line %d: Failed to allocate memory for eap_req_id_text",
@@ -2112,6 +2113,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
} else if (os_strcmp(buf, "nas_identifier") == 0) {
+ os_free(bss->nas_identifier);
bss->nas_identifier = os_strdup(pos);
#ifndef CONFIG_NO_RADIUS
} else if (os_strcmp(buf, "auth_server_addr") == 0) {
@@ -2136,6 +2138,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
line);
return 1;
}
+ os_free(bss->radius->auth_server->shared_secret);
bss->radius->auth_server->shared_secret = (u8 *) os_strdup(pos);
bss->radius->auth_server->shared_secret_len = len;
} else if (os_strcmp(buf, "acct_server_addr") == 0) {
@@ -2160,6 +2163,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
line);
return 1;
}
+ os_free(bss->radius->acct_server->shared_secret);
bss->radius->acct_server->shared_secret = (u8 *) os_strdup(pos);
bss->radius->acct_server->shared_secret_len = len;
} else if (os_strcmp(buf, "radius_retry_primary_interval") == 0) {
@@ -2315,6 +2319,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "rsn_preauth") == 0) {
bss->rsn_preauth = atoi(pos);
} else if (os_strcmp(buf, "rsn_preauth_interfaces") == 0) {
+ os_free(bss->rsn_preauth_interfaces);
bss->rsn_preauth_interfaces = os_strdup(pos);
#endif /* CONFIG_RSN_PREAUTH */
#ifdef CONFIG_PEERKEY
@@ -2564,6 +2569,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
}
#ifdef CONFIG_FULL_DYNAMIC_VLAN
} else if (os_strcmp(buf, "vlan_tagged_interface") == 0) {
+ os_free(bss->ssid.vlan_tagged_interface);
bss->ssid.vlan_tagged_interface = os_strdup(pos);
#endif /* CONFIG_FULL_DYNAMIC_VLAN */
#endif /* CONFIG_NO_VLAN */
@@ -2768,6 +2774,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
return 1;
}
} else if (os_strcmp(buf, "upnp_iface") == 0) {
+ os_free(bss->upnp_iface);
bss->upnp_iface = os_strdup(pos);
} else if (os_strcmp(buf, "friendly_name") == 0) {
os_free(bss->friendly_name);