Fix a possible memleak in SRP_VBASE_new
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 6 Sep 2023 12:06:52 +0000 (14:06 +0200)
committerTomas Mraz <tomas@openssl.org>
Fri, 8 Sep 2023 07:21:08 +0000 (09:21 +0200)
In the error handling case the memory in
vb->users_pwd was accidentally not released.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21981)

(cherry picked from commit 68e95f7840d0d8ac4e5e03381cf9d305578dd1c7)

crypto/srp/srp_vfy.c

index e8beb60d278a08773fad58afb02bf25f9bad3e97..edcfb0c76e515df8b11d06de730b6b182d7a2d0b 100644 (file)
@@ -283,6 +283,7 @@ SRP_VBASE *SRP_VBASE_new(char *seed_key)
         return NULL;
     if ((vb->users_pwd = sk_SRP_user_pwd_new_null()) == NULL
         || (vb->gN_cache = sk_SRP_gN_cache_new_null()) == NULL) {
+        sk_SRP_user_pwd_free(vb->users_pwd);
         OPENSSL_free(vb);
         return NULL;
     }