[vlc-devel] [PATCH 1/2] avcodec: fix memory leak
Vittorio Giovara
vittorio.giovara at gmail.com
Fri Jul 24 18:08:15 CEST 2015
On Fri, Jul 24, 2015 at 3:59 PM, Hannes Domani <ssbssa at yahoo.de> wrote:
> ---
> modules/codec/avcodec/audio.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
> index fd3a7c0..15a646d 100644
> --- a/modules/codec/avcodec/audio.c
> +++ b/modules/codec/avcodec/audio.c
> @@ -369,6 +369,7 @@ static block_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
> if (unlikely(p_block == NULL))
> goto drop;
> }
> + frame = NULL;
>
> if (p_sys->b_extract)
> { /* TODO: do not drop channels... at least not here */
> @@ -403,6 +404,8 @@ static block_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
> end:
> *pp_block = NULL;
> drop:
> + if( frame != NULL )
> + av_frame_free(&frame);
> if( p_block != NULL )
> block_Release(p_block);
> return NULL;
You don't need to check for NULL, it's done internally.
--
Vittorio
More information about the vlc-devel
mailing list