From b6c0beaf8b14bf3b5a7140d0a142a7934bab2d3c Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Sun, 18 Dec 2022 11:13:26 +0200 Subject: [PATCH] defensive if --- bindings/java/c_kzg_4844_jni.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bindings/java/c_kzg_4844_jni.c b/bindings/java/c_kzg_4844_jni.c index dd7ab72..5de5fe5 100644 --- a/bindings/java/c_kzg_4844_jni.c +++ b/bindings/java/c_kzg_4844_jni.c @@ -9,9 +9,12 @@ KZGSettings *settings; void reset_trusted_setup() { - free_trusted_setup(settings); - free(settings); - settings = NULL; + if (settings) + { + free_trusted_setup(settings); + free(settings); + settings = NULL; + } } void throw_exception(JNIEnv *env, const char *message)