srp: fix double free,
authorPauli <pauli@openssl.org>
Sun, 18 Apr 2021 22:51:38 +0000 (08:51 +1000)
committerPauli <pauli@openssl.org>
Tue, 20 Apr 2021 23:17:22 +0000 (09:17 +1000)
commitb06450bcf763735a89b65ca3ec176600fe7fceed
treef957caf38574a9bfb584ebeee2b7819ace90840d
parent4ecb19d1092d6db1397aa24512996f98f8e5e268
srp: fix double free,

In function SRP_create_verifier_ex, it calls SRP_create_verifier_BN_ex(..., &v, ..) at line 653.
In the implementation of SRP_create_verifier_BN_ex(), *verify (which is the paremeter of v) is allocated a pointer via BN_new() at line 738.
And *verify is freed via BN_clear_free() at line 743, and return 0.
Then the execution continues up to goto err at line 655, and the freed v is freed again at line 687.

Bug reported by @Yunlongs

Fixes #14913

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14921)
crypto/srp/srp_vfy.c