[FFmpeg-devel] [PATCH 2/9] apngenc: Add missing error check

Michael Niedermayer michael at niedermayer.cc
Thu Oct 19 04:08:43 EEST 2017


On Tue, Oct 17, 2017 at 10:12:18PM +0100, Mark Thompson wrote:
> ---
>  libavformat/apngenc.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c
> index 77c1c916c2..16ead54cc8 100644
> --- a/libavformat/apngenc.c
> +++ b/libavformat/apngenc.c
> @@ -217,8 +217,12 @@ static int flush_packet(AVFormatContext *format_context, AVPacket *packet)
>      ++apng->frame_number;
>  
>      av_packet_unref(apng->prev_packet);
> -    if (packet)
> -        av_packet_ref(apng->prev_packet, packet);
> +    if (packet) {
> +        int ret;
> +        ret = av_packet_ref(apng->prev_packet, packet);
> +        if (ret < 0)
> +            return ret;
> +    }
>      return 0;
>  }
>  
> @@ -232,7 +236,9 @@ static int apng_write_packet(AVFormatContext *format_context, AVPacket *packet)
>          if (!apng->prev_packet)
>              return AVERROR(ENOMEM);
>  
> -        av_packet_ref(apng->prev_packet, packet);
> +        ret = av_packet_ref(apng->prev_packet, packet);
> +        if (ret < 0)
> +            return ret;
>      } else {
>          ret = flush_packet(format_context, packet);
>          if (ret < 0)

probably ok

thx

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- 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/20171019/5a6c00d8/attachment.sig>


More information about the ffmpeg-devel mailing list