From d0b1e6049b06eeeeca146ece4d2f199c5dba1565 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
Date: Thu, 14 Jul 2016 22:03:16 +0300
Subject: [PATCH] libopenh264dec: Fix cleanup if the init failed early
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 libavcodec/libopenh264dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libopenh264dec.c b/libavcodec/libopenh264dec.c
index cdbea7be573..a105fa52d96 100644
--- a/libavcodec/libopenh264dec.c
+++ b/libavcodec/libopenh264dec.c
@@ -48,7 +48,7 @@ static av_cold int svc_decode_close(AVCodecContext *avctx)
     if (s->decoder)
         WelsDestroyDecoder(s->decoder);
 
-    while (av_fifo_size(s->packet_fifo) >= sizeof(pkt)) {
+    while (s->packet_fifo && av_fifo_size(s->packet_fifo) >= sizeof(pkt)) {
         av_fifo_generic_read(s->packet_fifo, &pkt, sizeof(pkt), NULL);
         av_packet_unref(&pkt);
     }
-- 
GitLab