提交 7b1dde03 编写于 作者: A Andy Walls 提交者: Mauro Carvalho Chehab

V4L/DVB (13904): cx18: Fix TS and IDX stream buffer memory leak on module unload

Fix a long standing memory leak of stream buffers for streams that did not
have a struct video_device allocated: namely the TS and IDX streams.
Signed-off-by: NAndy Walls <awalls@radix.net>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 540bab93
......@@ -419,6 +419,9 @@ void cx18_stream_free(struct cx18_stream *s)
{
struct cx18_mdl *mdl;
struct cx18_buffer *buf;
struct cx18 *cx = s->cx;
CX18_DEBUG_INFO("Deallocating buffers for %s stream\n", s->name);
/* move all buffers to buf_pool and all MDLs to q_idle */
cx18_unload_queues(s);
......
......@@ -319,11 +319,27 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister)
/* Teardown all streams */
for (type = 0; type < CX18_MAX_STREAMS; type++) {
if (cx->streams[type].dvb.enabled) {
cx18_dvb_unregister(&cx->streams[type]);
cx->streams[type].dvb.enabled = false;
/* No struct video_device, but can have buffers allocated */
if (type == CX18_ENC_STREAM_TYPE_TS) {
if (cx->streams[type].dvb.enabled) {
cx18_dvb_unregister(&cx->streams[type]);
cx->streams[type].dvb.enabled = false;
cx18_stream_free(&cx->streams[type]);
}
continue;
}
/* No struct video_device, but can have buffers allocated */
if (type == CX18_ENC_STREAM_TYPE_IDX) {
if (cx->stream_buffers[type] != 0) {
cx->stream_buffers[type] = 0;
cx18_stream_free(&cx->streams[type]);
}
continue;
}
/* If struct video_device exists, can have buffers allocated */
vdev = cx->streams[type].video_dev;
cx->streams[type].video_dev = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册