decoder/flac: free the "pathname" variable earlier
Free the pointer right after its last use, i.e. after the FLAC__stream_decoder_init_file() call.
This commit is contained in:
parent
183725733a
commit
4a8cc87b4d
@ -531,6 +531,7 @@ flac_container_decode(struct decoder* decoder,
|
|||||||
FLAC__StreamMetadata* cs = NULL;
|
FLAC__StreamMetadata* cs = NULL;
|
||||||
|
|
||||||
FLAC__StreamDecoder *flac_dec;
|
FLAC__StreamDecoder *flac_dec;
|
||||||
|
FLAC__StreamDecoderInitStatus init_status;
|
||||||
struct flac_data data;
|
struct flac_data data;
|
||||||
const char *err = NULL;
|
const char *err = NULL;
|
||||||
|
|
||||||
@ -578,34 +579,20 @@ flac_container_decode(struct decoder* decoder,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
init_status = is_ogg
|
||||||
if (is_ogg)
|
? FLAC__stream_decoder_init_ogg_file(flac_dec, pathname,
|
||||||
{
|
flac_write_cb,
|
||||||
if (FLAC__stream_decoder_init_ogg_file( flac_dec,
|
flacMetadata,
|
||||||
pathname,
|
flac_error_cb,
|
||||||
flac_write_cb,
|
&data)
|
||||||
flacMetadata,
|
: FLAC__stream_decoder_init_file(flac_dec,
|
||||||
flac_error_cb,
|
pathname, flac_write_cb,
|
||||||
(void*) &data )
|
flacMetadata, flac_error_cb,
|
||||||
!= FLAC__STREAM_DECODER_INIT_STATUS_OK )
|
&data);
|
||||||
{
|
g_free(pathname);
|
||||||
err = "doing Ogg init()";
|
if (init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
|
||||||
goto fail;
|
err = "doing init()";
|
||||||
}
|
goto fail;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (FLAC__stream_decoder_init_file( flac_dec,
|
|
||||||
pathname,
|
|
||||||
flac_write_cb,
|
|
||||||
flacMetadata,
|
|
||||||
flac_error_cb,
|
|
||||||
(void*) &data )
|
|
||||||
!= FLAC__STREAM_DECODER_INIT_STATUS_OK )
|
|
||||||
{
|
|
||||||
err = "doing init()";
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FLAC__stream_decoder_process_until_end_of_metadata(flac_dec))
|
if (!FLAC__stream_decoder_process_until_end_of_metadata(flac_dec))
|
||||||
@ -637,9 +624,6 @@ flac_container_decode(struct decoder* decoder,
|
|||||||
flac_decoder_loop(&data, flac_dec, t_start, t_end);
|
flac_decoder_loop(&data, flac_dec, t_start, t_end);
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (pathname)
|
|
||||||
g_free(pathname);
|
|
||||||
|
|
||||||
flac_data_deinit(&data);
|
flac_data_deinit(&data);
|
||||||
FLAC__stream_decoder_delete(flac_dec);
|
FLAC__stream_decoder_delete(flac_dec);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user