diff --git a/lib_com/options.h b/lib_com/options.h index fda3eb0d4df7e69f5225e6084a9f972b11c68153..7ae362777bcaf7add3a7b4577ee945a202bb3c08 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,6 +159,7 @@ #define FIX_1024_REMOVE_PARAMMC_MIXING_MAT /* VA: issue 1024: remove unused function ivas_param_mc_get_mono_stereo_mixing_matrices() */ #define FIX_1023_REMOVE_PARAMMC_DEC /* VA: issue 1023: remove unused function ivas_param_mc_dec() */ #define FIX_1022_REMOVE_PARAMISM_DEC /* VA: issue 1022: remove unused function ivas_param_ism_dec() */ +#define FIX_1033_MEMORY_LEAK_OMASA /* Nokia / Orange: issue #1033: Memory leak in OMASA to BINAURAL with HRTF with bitrate switching */ #define FIX_1035_HT_OSBA /* Dlb: issue 1035: Issue with headtracking in OSBA*/ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 1df83b0ce57feeca4685e83bbccb1472a060b9dc..e0ef92ecfc602e444bf47164fe023fe9f8b22962 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1210,8 +1210,15 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - st_ivas->hHrtfTD = NULL; +#ifdef FIX_1033_MEMORY_LEAK_OMASA + if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) + { +#endif + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + st_ivas->hHrtfTD = NULL; +#ifdef FIX_1033_MEMORY_LEAK_OMASA + } +#endif } #ifdef SPLIT_REND_WITH_HEAD_ROT diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 763c37a709d4613370a1c4a0b6fd01dd9bcbaf08..b1a0a0e9eece6c22656bbbe2729b3f5d0fe79dc7 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -378,11 +378,17 @@ ivas_error ivas_omasa_dec_config( if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC ) { /* Allocate TD renderer for the objects in DISC mode */ - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) +#ifdef FIX_1033_MEMORY_LEAK_OMASA + if ( st_ivas->hBinRendererTd == NULL ) { - return error; +#endif + if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1033_MEMORY_LEAK_OMASA } - +#endif /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -391,10 +397,16 @@ ivas_error ivas_omasa_dec_config( } else { - /* TD renderer handle */ - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - st_ivas->hHrtfTD = NULL; - +#ifdef FIX_1033_MEMORY_LEAK_OMASA + if ( st_ivas->hBinRendererTd != NULL && st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) + { +#endif + /* TD renderer handle */ + ivas_td_binaural_close( &st_ivas->hBinRendererTd ); + st_ivas->hHrtfTD = NULL; +#ifdef FIX_1033_MEMORY_LEAK_OMASA + } +#endif /* ISM renderer handle + ISM data handle */ ivas_omasa_separate_object_renderer_close( st_ivas ); }