v4l2_m2m: decoder: fix memory leak
authorLukas Rusak <lorusak@gmail.com>
Tue, 26 Jun 2018 21:36:46 +0000 (14:36 -0700)
committerJorge Ramirez-Ortiz <jramirez@baylibre.com>
Wed, 27 Jun 2018 06:38:50 +0000 (08:38 +0200)
libavcodec/v4l2_m2m_dec.c

index 598dc10..710e40e 100644 (file)
@@ -149,11 +149,14 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
 
     if (avpkt.size) {
         ret = v4l2_try_start(avctx);
-        if (ret)
+        if (ret) {
+            av_packet_unref(&avpkt);
             return 0;
+        }
     }
 
 dequeue:
+    av_packet_unref(&avpkt);
     return ff_v4l2_context_dequeue_frame(capture, frame);
 }