]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Coverity 1507376: Dereference after null check
authorPauli <pauli@openssl.org>
Thu, 21 Jul 2022 02:46:27 +0000 (12:46 +1000)
committerTomas Mraz <tomas@openssl.org>
Fri, 22 Jul 2022 12:42:13 +0000 (14:42 +0200)
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18837)

crypto/sparse_array.c

index 53e6e7d46076f233cefc65d6522c4b209bf76de8..bbbc9cdb36966c9778bb83c4a484c51516284f07 100644 (file)
@@ -109,8 +109,10 @@ static void sa_free_leaf(ossl_uintmax_t n, void *p, void *arg)
 
 void ossl_sa_free(OPENSSL_SA *sa)
 {
-    sa_doall(sa, &sa_free_node, NULL, NULL);
-    OPENSSL_free(sa);
+    if (sa != NULL) {
+        sa_doall(sa, &sa_free_node, NULL, NULL);
+        OPENSSL_free(sa);
+    }
 }
 
 void ossl_sa_free_leaves(OPENSSL_SA *sa)