[FFmpeg-devel] [PATCH V1 1/6] lavf/4xm: fix memory leak in error handing path

Michael Niedermayer michael at niedermayer.cc
Sun Sep 22 14:45:34 EEST 2019


On Sat, Sep 21, 2019 at 10:12:10AM +0800, Jun Zhao wrote:
> From: Jun Zhao <barryjzhao at tencent.com>
> 
> need to free the header in error path
> 
> Signed-off-by: Jun Zhao <barryjzhao at tencent.com>
> ---
>  libavformat/4xm.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/4xm.c b/libavformat/4xm.c
> index a984fc9..8054980 100644
> --- a/libavformat/4xm.c
> +++ b/libavformat/4xm.c
> @@ -241,6 +241,7 @@ static int fourxm_read_header(AVFormatContext *s)
>          size       = AV_RL32(&header[i + 4]);
>          if (size > header_size - i - 8 && (fourcc_tag == vtrk_TAG || fourcc_tag == strk_TAG)) {
>              av_log(s, AV_LOG_ERROR, "chunk larger than array %d>%d\n", size, header_size - i - 8);
> +            av_free(header);
>              return AVERROR_INVALIDDATA;

this doesnt free everything, a goto fail is probably better

thx

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190922/10c0bd03/attachment.sig>


More information about the ffmpeg-devel mailing list