]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-EKE peer: Fix memory leak on error path
authorJouni Malinen <j@w1.fi>
Mon, 30 Nov 2015 22:20:25 +0000 (00:20 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 30 Nov 2015 22:20:25 +0000 (00:20 +0200)
If DHComponent_P derivation fails (local crypto operation failure), the
message buffer was not freed.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/eap_peer/eap_eke.c

index dfbda5644f6fcaa271cf4f0c49f07c10670e5e2f..1fd49705444ddfc8d426d9764f60d855e5708b9d 100644 (file)
@@ -452,6 +452,7 @@ static struct wpabuf * eap_eke_process_commit(struct eap_sm *sm,
        /* DHComponent_P = Encr(key, y_p) */
        rpos = wpabuf_put(resp, data->sess.dhcomp_len);
        if (eap_eke_dhcomp(&data->sess, key, pub, rpos) < 0) {
+               wpabuf_free(resp);
                wpa_printf(MSG_INFO, "EAP-EKE: Failed to build DHComponent_P");
                os_memset(key, 0, sizeof(key));
                return eap_eke_build_fail(data, ret, id,