aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2018-11-25 11:49:44 (GMT)
committerJouni Malinen <j@w1.fi>2018-11-25 11:49:44 (GMT)
commitc7896ef9c63801c8deb2cee7d980c5578649129d (patch)
tree8b531e0e3b3abf06cc5dbff1f271afe3440bce84 /src/common
parent931f7ff656096abcf5c992c04716a6203589b3d5 (diff)
downloadhostap-c7896ef9c63801c8deb2cee7d980c5578649129d.zip
hostap-c7896ef9c63801c8deb2cee7d980c5578649129d.tar.gz
hostap-c7896ef9c63801c8deb2cee7d980c5578649129d.tar.bz2
DPP: Fix memory leaks in GAS server error path handling
If local memory allocation for the GAS response failed, couple of error paths ended up leaking some memory maintaining the state for the exchange. Fix that by freeing the context properly. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/gas_server.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common/gas_server.c b/src/common/gas_server.c
index b258675..492ee00 100644
--- a/src/common/gas_server.c
+++ b/src/common/gas_server.c
@@ -97,8 +97,10 @@ gas_server_send_resp(struct gas_server *gas, struct gas_server_handler *handler,
return;
response = os_zalloc(sizeof(*response));
- if (!response)
+ if (!response) {
+ wpabuf_free(query_resp);
return;
+ }
wpa_printf(MSG_DEBUG, "DPP: Allocated GAS response @%p", response);
response->freq = freq;
response->handler = handler;
@@ -119,6 +121,7 @@ gas_server_send_resp(struct gas_server *gas, struct gas_server_handler *handler,
handler->adv_proto_id_len +
resp_frag_len);
if (!resp) {
+ wpabuf_free(query_resp);
gas_server_free_response(response);
return;
}