aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2014-03-11 20:41:12 (GMT)
committerJouni Malinen <j@w1.fi>2014-03-11 23:09:21 (GMT)
commitb2e32cde83686f78f6db9ee159eea8c941b70c1c (patch)
tree3cad41d67bb0f2a9aa095dc1f48a976e46f81a87 /hostapd
parenta0b728b7e2afb5f1d081b0cfc85e29f9db6457d3 (diff)
downloadhostap-b2e32cde83686f78f6db9ee159eea8c941b70c1c.zip
hostap-b2e32cde83686f78f6db9ee159eea8c941b70c1c.tar.gz
hostap-b2e32cde83686f78f6db9ee159eea8c941b70c1c.tar.bz2
Fix memory leaks on wpa_config_parse_string() error paths
hostapd configuration parser did not free the temporary buffer on some error paths. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/config_file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 548cb9a..eb096db 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -1679,6 +1679,7 @@ static int hs20_parse_osu_ssid(struct hostapd_bss_config *bss,
str = wpa_config_parse_string(pos, &slen);
if (str == NULL || slen < 1 || slen > HOSTAPD_MAX_SSID_LEN) {
wpa_printf(MSG_ERROR, "Line %d: Invalid SSID '%s'", line, pos);
+ os_free(str);
return -1;
}
@@ -1893,12 +1894,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
if (str == NULL || slen < 1 || slen > HOSTAPD_MAX_SSID_LEN) {
wpa_printf(MSG_ERROR, "Line %d: invalid SSID '%s'",
line, pos);
+ os_free(str);
return 1;
- } else {
- os_memcpy(bss->ssid.ssid, str, slen);
- bss->ssid.ssid_len = slen;
- bss->ssid.ssid_set = 1;
}
+ os_memcpy(bss->ssid.ssid, str, slen);
+ bss->ssid.ssid_len = slen;
+ bss->ssid.ssid_set = 1;
os_free(str);
} else if (os_strcmp(buf, "utf8_ssid") == 0) {
bss->ssid.utf8_ssid = atoi(pos) > 0;