diff mbox

[FFmpeg-devel,3/9] gif: Add missing error check

Message ID 20171017211225.3175-3-sw@jkqxz.net
State New
Headers show

Commit Message

Mark Thompson Oct. 17, 2017, 9:12 p.m. UTC
---
 libavformat/gif.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/libavformat/gif.c b/libavformat/gif.c
index 01d98a27b0..3336152c06 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -174,8 +174,12 @@  static int flush_packet(AVFormatContext *s, AVPacket *new)
     avio_write(pb, pkt->data, pkt->size);
 
     av_packet_unref(gif->prev_pkt);
-    if (new)
-        av_packet_ref(gif->prev_pkt, new);
+    if (new) {
+        int ret;
+        ret = av_packet_ref(gif->prev_pkt, new);
+        if (ret < 0)
+            return ret;
+    }
 
     return 0;
 }