On Tue, Sep 10, 2019 at 07:39:27PM +0800, Jun Zhao wrote:
> From: Jun Zhao <barryjz...@tencent.com>
> 
> free the value in error handling path to avoid the memory leak.
> 
> Signed-off-by: Jun Zhao <barryjz...@tencent.com>
> ---
>  libavformat/avidec.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
> index df78925..e3cd844 100644
> --- a/libavformat/avidec.c
> +++ b/libavformat/avidec.c
> @@ -306,8 +306,10 @@ static int avi_read_tag(AVFormatContext *s, AVStream 
> *st, uint32_t tag,
>      value = av_malloc(size + 1);
>      if (!value)
>          return AVERROR(ENOMEM);
> -    if (avio_read(pb, value, size) != size)
> +    if (avio_read(pb, value, size) != size) {
> +        av_freep(&value);
>          return AVERROR_INVALIDDATA;
> +    }
>      value[size] = 0;

will apply

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to