]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Fix a memory leak on an error path
authorAlexander Wetzel <alexander@wetzel-home.de>
Fri, 20 Dec 2019 19:21:25 +0000 (20:21 +0100)
committerJouni Malinen <j@w1.fi>
Sat, 21 Dec 2019 15:02:00 +0000 (17:02 +0200)
Fix a memory leak exposed by the dpp_own_config_sign_fail test.

Fixes: 52d469de1112 ("DPP2: Support multiple Config Objects in Enrollee")
Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
src/common/dpp.c

index 0d0c47ec84514ca97ce09274930f222b93d40dc7..8c873fdf067085db9cfcb1ab01d5faddfc1b2fdb 100644 (file)
@@ -6859,8 +6859,11 @@ int dpp_configurator_own_config(struct dpp_authentication *auth,
        dpp_copy_csign(&auth->conf_obj[0], auth->conf->csign);
 
        conf_obj = dpp_build_conf_obj(auth, ap, 0);
-       if (!conf_obj)
+       if (!conf_obj) {
+               wpabuf_free(auth->conf_obj[0].c_sign_key);
+               auth->conf_obj[0].c_sign_key = NULL;
                goto fail;
+       }
        ret = dpp_parse_conf_obj(auth, wpabuf_head(conf_obj),
                                 wpabuf_len(conf_obj));
 fail: