diff options
author | Andy Walls <awalls@radix.net> | 2009-12-30 23:35:08 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:29 -0500 |
commit | 7b1dde03314912cfa9a5fa34ea9423df0db13860 (patch) | |
tree | e5d03c2ee9ae540d55204ae80986227110edb4e0 /drivers/media/video/cx18/cx18-streams.c | |
parent | 540bab93b769c757e92f1bd5e980a2ef647d4e86 (diff) |
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: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-streams.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-streams.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index 9be603c00fb4..1764971f3dac 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -319,11 +319,27 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister) | |||
319 | 319 | ||
320 | /* Teardown all streams */ | 320 | /* Teardown all streams */ |
321 | for (type = 0; type < CX18_MAX_STREAMS; type++) { | 321 | for (type = 0; type < CX18_MAX_STREAMS; type++) { |
322 | if (cx->streams[type].dvb.enabled) { | 322 | |
323 | cx18_dvb_unregister(&cx->streams[type]); | 323 | /* No struct video_device, but can have buffers allocated */ |
324 | cx->streams[type].dvb.enabled = false; | 324 | if (type == CX18_ENC_STREAM_TYPE_TS) { |
325 | if (cx->streams[type].dvb.enabled) { | ||
326 | cx18_dvb_unregister(&cx->streams[type]); | ||
327 | cx->streams[type].dvb.enabled = false; | ||
328 | cx18_stream_free(&cx->streams[type]); | ||
329 | } | ||
330 | continue; | ||
331 | } | ||
332 | |||
333 | /* No struct video_device, but can have buffers allocated */ | ||
334 | if (type == CX18_ENC_STREAM_TYPE_IDX) { | ||
335 | if (cx->stream_buffers[type] != 0) { | ||
336 | cx->stream_buffers[type] = 0; | ||
337 | cx18_stream_free(&cx->streams[type]); | ||
338 | } | ||
339 | continue; | ||
325 | } | 340 | } |
326 | 341 | ||
342 | /* If struct video_device exists, can have buffers allocated */ | ||
327 | vdev = cx->streams[type].video_dev; | 343 | vdev = cx->streams[type].video_dev; |
328 | 344 | ||
329 | cx->streams[type].video_dev = NULL; | 345 | cx->streams[type].video_dev = NULL; |