[FFmpeg-cvslog] lavc/gif: merge two allocation checks.

Clément Bœsch git at videolan.org
Thu Apr 18 00:26:57 CEST 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Thu Apr 18 00:19:33 2013 +0200| [71411b69a22526832e2c8d92cd1faf60e05528a3] | committer: Clément Bœsch

lavc/gif: merge two allocation checks.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=71411b69a22526832e2c8d92cd1faf60e05528a3
---

 libavcodec/gif.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/gif.c b/libavcodec/gif.c
index f373819..66847bb 100644
--- a/libavcodec/gif.c
+++ b/libavcodec/gif.c
@@ -191,11 +191,9 @@ static av_cold int gif_encode_init(AVCodecContext *avctx)
 
     avctx->coded_frame = &s->picture;
     s->lzw = av_mallocz(ff_lzw_encode_state_size);
-    if (!s->lzw)
-        return AVERROR(ENOMEM);
     s->buf = av_malloc(avctx->width*avctx->height*2);
-    if (!s->buf)
-         return AVERROR(ENOMEM);
+    if (!s->buf || !s->lzw)
+        return AVERROR(ENOMEM);
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list