From 031fcc9bf6cba86d86bf3adab7b43811d5d0ef88 Mon Sep 17 00:00:00 2001 From: colinhl Date: Mon, 8 Jul 2024 10:58:30 +0800 Subject: [PATCH] add nullptr check when astc mem free Signed-off-by: colinhl --- Source/astcenc_entry.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Source/astcenc_entry.cpp b/Source/astcenc_entry.cpp index 81f8f6b..c079c40 100644 --- a/Source/astcenc_entry.cpp +++ b/Source/astcenc_entry.cpp @@ -789,8 +789,22 @@ void astcenc_context_free( if (ctxo) { astcenc_contexti* ctx = &ctxo->context; - aligned_free(ctx->working_buffers); - aligned_free(ctx->bsd); + if (ctx->working_buffers) + { + aligned_free(ctx->working_buffers); + } + else + { + printf("ctx->working_buffers is nullptr !!\n"); + } + if (ctx->bsd) + { + aligned_free(ctx->bsd); + } + else + { + printf("ctx->bsd is nullptr !!\n"); + } #if defined(ASTCENC_DIAGNOSTICS) delete ctx->trace_log; #endif -- Gitee