kdfs: make free calls check for NULL.
[openssl.git] / providers / implementations / kdfs / tls1_prf.c
index 941286b6b5372ce74d52b7ea9927236e30994b79..84d712afc5571c72486cb3d6391b147db1f8d076 100644 (file)
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
 #include "crypto/evp.h"
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
 #include "crypto/evp.h"
-#include "internal/provider_ctx.h"
-#include "internal/providercommonerr.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
 #include "prov/implementations.h"
-#include "internal/provider_util.h"
+#include "prov/provider_util.h"
 #include "e_os.h"
 
 static OSSL_OP_kdf_newctx_fn kdf_tls1_prf_new;
 #include "e_os.h"
 
 static OSSL_OP_kdf_newctx_fn kdf_tls1_prf_new;
@@ -106,8 +106,10 @@ static void kdf_tls1_prf_free(void *vctx)
 {
     TLS1_PRF *ctx = (TLS1_PRF *)vctx;
 
 {
     TLS1_PRF *ctx = (TLS1_PRF *)vctx;
 
-    kdf_tls1_prf_reset(ctx);
-    OPENSSL_free(ctx);
+    if (ctx != NULL) {
+        kdf_tls1_prf_reset(ctx);
+        OPENSSL_free(ctx);
+    }
 }
 
 static void kdf_tls1_prf_reset(void *vctx)
 }
 
 static void kdf_tls1_prf_reset(void *vctx)