aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/mesh.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-04-19 08:57:05 (GMT)
committerJouni Malinen <j@w1.fi>2015-04-22 08:44:19 (GMT)
commitc9bf7b66234eafc07db6fda9cfc26e0c151e417e (patch)
treecdcd4ab287ab6bdf506fcfd7ce1028bdff46f8b3 /wpa_supplicant/mesh.c
parentd4c4ec9240eed83f51300da17a7847cb36549dd7 (diff)
downloadhostap-c9bf7b66234eafc07db6fda9cfc26e0c151e417e.zip
hostap-c9bf7b66234eafc07db6fda9cfc26e0c151e417e.tar.gz
hostap-c9bf7b66234eafc07db6fda9cfc26e0c151e417e.tar.bz2
Fix a memory leak on mesh_attr_text() error path
Should there not be enough room in the output buffer, the bss_basic_rate_set line would not be printed. This error case was handled otherwise, but the temporary memory allocation for building the information was not freed. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/mesh.c')
-rw-r--r--wpa_supplicant/mesh.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 33b4af3..ca012e2 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -453,22 +453,23 @@ static int mesh_attr_text(const u8 *ies, size_t ies_len, char *buf, char *end)
ret = os_snprintf(pos, end - pos, "bss_basic_rate_set=%d",
bss_basic_rate_set[0]);
if (os_snprintf_error(end - pos, ret))
- return pos - buf;
+ goto fail;
pos += ret;
for (i = 1; i < bss_basic_rate_set_len; i++) {
ret = os_snprintf(pos, end - pos, " %d",
bss_basic_rate_set[i]);
if (os_snprintf_error(end - pos, ret))
- return pos - buf;
+ goto fail;
pos += ret;
}
ret = os_snprintf(pos, end - pos, "\n");
if (os_snprintf_error(end - pos, ret))
- return pos - buf;
+ goto fail;
pos += ret;
}
+fail:
os_free(bss_basic_rate_set);
return pos - buf;