Core: allow NULL argument to stored_namemap_free().
authorPauli <paul.dale@oracle.com>
Wed, 20 Nov 2019 20:55:50 +0000 (06:55 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 21 Nov 2019 22:18:42 +0000 (08:18 +1000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10488)

crypto/core_namemap.c

index e5a17272d888956a1693de3c1f678597708b0506..9b19d60db3051c481e12aad90a38a9db806004a8 100644 (file)
@@ -72,9 +72,11 @@ static void stored_namemap_free(void *vnamemap)
 {
     OSSL_NAMEMAP *namemap = vnamemap;
 
-    /* Pretend it isn't stored, or ossl_namemap_free() will do nothing */
-    namemap->stored = 0;
-    ossl_namemap_free(namemap);
+    if (namemap != NULL) {
+        /* Pretend it isn't stored, or ossl_namemap_free() will do nothing */
+        namemap->stored = 0;
+        ossl_namemap_free(namemap);
+    }
 }
 
 static const OPENSSL_CTX_METHOD stored_namemap_method = {