Wrong closing of decoder, renderer, and post-renderer applications in case of errors
In case of an error, the error message is returned and the decoder application is closed.
The correct closing of an application assumes a call of goto cleanup;
to close all open external files. However, this is not done consistently and return error;
is used instead which skips the closing of external files in functions main()
, decodeG192()
, decodeVoIP()
.
E.g.:
/* Load HRTF binary file data */
if ( arg.hrtfReaderEnabled )
{
if ( ( error = load_hrtf_from_file( hHrtfBinary, hIvasDec, arg.outputConfig, arg.output_Fs ) ) != IVAS_ERR_OK )
{
fprintf( stderr, "\nIVAS_DEC_LoadHrtfFromFile failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
goto cleanup;
}
}
/* decode transport channels, do TSM and feed to renderer */
if ( ( error = IVAS_DEC_GetSamplesDecoder( hIvasDec, isSplitRend, splitRendBits ) ) != IVAS_ERR_OK )
{
return error; // HERE goto cleanup; SHOULD BE USED
}
In addition, a correct exit and deallocation of memory is missing in case of errors in renderer and post-renderer applications (see also #741).
Edited by vaclav