Ensure OSSL_PARAM_BLD_free() can accept a NULL
authorMatt Caswell <matt@openssl.org>
Fri, 24 Apr 2020 10:44:15 +0000 (11:44 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 4 May 2020 08:30:55 +0000 (09:30 +0100)
All OpenSSL free functions should accept NULL.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11635)

crypto/param_build.c

index 43b194bceab53418db6b9406e2c518d28b81b1ec..76522cd3770f26a047815345c6541f4e5f25d398 100644 (file)
@@ -125,6 +125,8 @@ static void free_all_params(OSSL_PARAM_BLD *bld)
 
 void OSSL_PARAM_BLD_free(OSSL_PARAM_BLD *bld)
 {
+    if (bld == NULL)
+        return;
     free_all_params(bld);
     sk_OSSL_PARAM_BLD_DEF_free(bld->params);
     OPENSSL_free(bld);