On 06/26/2018 11:36 PM, Lukas Rusak wrote:
This was found using valgrind. Using this patch there is no more memleak 
present.
---
  libavcodec/v4l2_m2m_dec.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 598dc10781..710e40efd8 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -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);
  }

ack'd and tested

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to