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);