[FFmpeg-devel] [PATCH] yuv4mpegdec: fix leaking pkt in yuv4_read_packet

Michael Niedermayer michael at niedermayer.cc
Wed Dec 7 04:18:00 EET 2016


On Mon, Dec 05, 2016 at 11:08:44PM +0100, Andreas Cadhalpun wrote:
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> ---
>  libavformat/yuv4mpegdec.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
> index a91645f..462b823 100644
> --- a/libavformat/yuv4mpegdec.c
> +++ b/libavformat/yuv4mpegdec.c
> @@ -295,9 +295,10 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
>      ret = av_get_packet(s->pb, pkt, s->packet_size - Y4M_FRAME_MAGIC_LEN);
>      if (ret < 0)
>          return ret;
> -    else if (ret != s->packet_size - Y4M_FRAME_MAGIC_LEN)
> +    else if (ret != s->packet_size - Y4M_FRAME_MAGIC_LEN) {
> +        av_packet_unref(pkt);
>          return s->pb->eof_reached ? AVERROR_EOF : AVERROR(EIO);
> -
> +    }

LGTM

thx

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

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161207/6da5e49d/attachment.sig>


More information about the ffmpeg-devel mailing list