From e2ebfc946a487eeb2cb9ddf59e7e0a877e991426 Mon Sep 17 00:00:00 2001 From: Marko Viitanen Date: Tue, 4 May 2021 16:44:05 +0300 Subject: [PATCH] [LMCS] Free lmcs_aps in correct place --- src/encoder_state-ctors_dtors.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/encoder_state-ctors_dtors.c b/src/encoder_state-ctors_dtors.c index 871b49bd..88c57eea 100644 --- a/src/encoder_state-ctors_dtors.c +++ b/src/encoder_state-ctors_dtors.c @@ -754,13 +754,16 @@ void kvz_encoder_state_finalize(encoder_state_t * const state) { if (!state->parent || (state->parent->slice != state->slice)) { + if (state->encoder_control->cfg.lmcs_enable) { + if (state->slice->lmcs_aps != NULL) { + FREE_POINTER(state->slice->lmcs_aps); + } + } + if (state->encoder_control->cfg.alf_type) { if (state->slice->apss != NULL) { FREE_POINTER(state->slice->apss); } - if (state->slice->lmcs_aps != NULL) { - FREE_POINTER(state->slice->lmcs_aps); - } if (state->slice->tile_group_luma_aps_id != NULL) { FREE_POINTER(state->slice->tile_group_luma_aps_id); }