]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Fix memory leaks in GAS server error path handling
authorJouni Malinen <j@w1.fi>
Sun, 25 Nov 2018 11:49:44 +0000 (13:49 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 25 Nov 2018 11:49:44 +0000 (13:49 +0200)
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>
src/common/gas_server.c

index b258675fa2a3b8c62827bd27f8f0d06878a64917..492ee0041a1774de9d4a447357dafe344057f3f7 100644 (file)
@@ -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;
        }