libopenh264dec: Fix cleanup if the init failed early
authorMartin Storsjö <martin@martin.st>
Thu, 14 Jul 2016 19:03:16 +0000 (22:03 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 15 Jul 2016 10:36:20 +0000 (13:36 +0300)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/libopenh264dec.c

index cdbea7b..a105fa5 100644 (file)
@@ -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);
     }