]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Fix a memory leak on error path for Config Result
authorJouni Malinen <jouni@codeaurora.org>
Sun, 15 Sep 2019 13:19:45 +0000 (16:19 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 15 Sep 2019 13:30:40 +0000 (16:30 +0300)
If only one of the allocations fails, the successful allocation needs to
be freed on the error path.

Fixes: 22f90b32f14e ("DPP2: Configuration Result message generation and processing")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/dpp.c

index dcbc80b6b84b2964090bcdf76122d78da178cc94..1d91a7adeb18affa1e3883fa7750dc574f10d593 100644 (file)
@@ -6108,7 +6108,7 @@ struct wpabuf * dpp_build_conf_result(struct dpp_authentication *auth,
        clear = wpabuf_alloc(clear_len);
        msg = dpp_alloc_msg(DPP_PA_CONFIGURATION_RESULT, attr_len);
        if (!clear || !msg)
-               return NULL;
+               goto fail;
 
        /* DPP Status */
        dpp_build_attr_status(clear, status);