From 1c8f1447e784f5fb343c0852ba95464b17694805 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Mon, 14 Apr 2025 20:13:13 +0100 Subject: [PATCH] mie: fix a nullptr deref in mie_ctx cleanup --- mie/builder.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mie/builder.c b/mie/builder.c index c54e154..50861f9 100644 --- a/mie/builder.c +++ b/mie/builder.c @@ -79,8 +79,10 @@ void mie_ctx_destroy(struct mie_ctx *ctx) const size_t nr_types = sizeof ctx->ctx_types / sizeof ctx->ctx_types[0]; for (size_t i = 0; i < nr_types; i++) { - mie_value_destroy(MIE_VALUE(ctx->ctx_types[i])); - ctx->ctx_types[i] = NULL; + if (ctx->ctx_types[i]) { + mie_value_destroy(MIE_VALUE(ctx->ctx_types[i])); + ctx->ctx_types[i] = NULL; + } } free(ctx);