Commit 0310f3dc authored by vaclav's avatar vaclav
Browse files

- avoid doubled initialization of structures to NULL

- assign 'hRenderConfig' to NULL in ivas_initialize_handles_dec() -> this fixes a crash in case of premature exit due to unassigned 'hRenderConfig'
parent 560a0b08
Loading
Loading
Loading
Loading
+11 −28
Original line number Diff line number Diff line
@@ -511,29 +511,6 @@ ivas_error ivas_init_decoder_front(

    error = IVAS_ERR_OK;

#ifdef DEBUGGING
    st_ivas->noClipping = 0;
#endif

    /* Custom loudspeaker layout structure */
    st_ivas->hLsSetupCustom = NULL;

    /* TD renderer HRTF data structure */
    st_ivas->hHrtfTD = NULL;

    /* Head track data structure */
    st_ivas->hHeadTrackData = NULL;

    /* Renderer configuration structure */
    st_ivas->hRenderConfig = NULL;

    /* HRTF binauralization latency in ns */
    st_ivas->binaural_latency_ns = 0;

#ifdef DEBUGGING
    st_ivas->hDecoderConfig->force_rend = -1;
#endif

    /*-----------------------------------------------------------------*
     * Resets
     *-----------------------------------------------------------------*/
@@ -546,9 +523,14 @@ ivas_error ivas_init_decoder_front(
    st_ivas->mc_mode = MC_MODE_NONE;
    st_ivas->sba_mode = SBA_MODE_NONE;
    
    st_ivas->hLimiter = NULL;
    st_ivas->hoa_dec_mtx = NULL;
    /* HRTF binauralization latency in ns */
    st_ivas->binaural_latency_ns = 0;

#ifdef DEBUGGING
    st_ivas->noClipping = 0;

    st_ivas->hDecoderConfig->force_rend = -1;
#endif

    /*-------------------------------------------------------------------*
     * Allocate and initialize Custom loudspeaker layout handle
@@ -1335,9 +1317,8 @@ ivas_error ivas_init_decoder(
     * Allocate and initialize limiter struct
     *-----------------------------------------------------------------*/

    {
    st_ivas->hLimiter = ivas_limiter_open( hDecoderConfig->nchan_out, output_Fs );
    }


    return error;
}
@@ -1550,11 +1531,13 @@ void ivas_initialize_handles_dec(
    st_ivas->hMonoDmxRenderer = NULL;
    st_ivas->hCrend = NULL;
    st_ivas->hHrtf = NULL;
    st_ivas->hoa_dec_mtx = NULL;

    st_ivas->hHeadTrackData = NULL;
    st_ivas->hHrtfTD = NULL;
    st_ivas->hLimiter = NULL;
    st_ivas->hLsSetupCustom = NULL;
    st_ivas->hRenderConfig = NULL;

    return;
}