[FFmpeg-devel] [PATCH] libavcodec: v4l2m2m: make sure to unref avpkt
Lukas Rusak
lorusak at gmail.com
Wed Jun 27 00:36:46 EEST 2018
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);
}
--
2.17.0
More information about the ffmpeg-devel
mailing list