diff options
author | Andrzej Pietrasiewicz <andrzej.p@samsung.com> | 2011-01-28 07:42:51 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 03:54:27 -0400 |
commit | a9bb36aa0d6547aa0ab3d5cfde08e8651bd460bc (patch) | |
tree | a2ee0417881a97bf76c1b400ec0721106e1bd8d7 /drivers/media/video/videobuf2-dma-sg.c | |
parent | 29e3fbd8edb31549fa8302c185bd0b915a43d8b8 (diff) |
[media] v4l2: vb2-dma-sg: fix memory leak
This patch fixes two minor memory leaks in videobuf2-dma-sg module. They
might happen only in case some other operations (like memory allocation)
failed.
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/videobuf2-dma-sg.c')
-rw-r--r-- | drivers/media/video/videobuf2-dma-sg.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/video/videobuf2-dma-sg.c b/drivers/media/video/videobuf2-dma-sg.c index 20b5c5dcc0ef..d5311ff3fab0 100644 --- a/drivers/media/video/videobuf2-dma-sg.c +++ b/drivers/media/video/videobuf2-dma-sg.c | |||
@@ -88,6 +88,7 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size) | |||
88 | fail_pages_alloc: | 88 | fail_pages_alloc: |
89 | while (--i >= 0) | 89 | while (--i >= 0) |
90 | __free_page(buf->pages[i]); | 90 | __free_page(buf->pages[i]); |
91 | kfree(buf->pages); | ||
91 | 92 | ||
92 | fail_pages_array_alloc: | 93 | fail_pages_array_alloc: |
93 | vfree(buf->sg_desc.sglist); | 94 | vfree(buf->sg_desc.sglist); |
@@ -176,6 +177,7 @@ userptr_fail_get_user_pages: | |||
176 | num_pages_from_user, buf->sg_desc.num_pages); | 177 | num_pages_from_user, buf->sg_desc.num_pages); |
177 | while (--num_pages_from_user >= 0) | 178 | while (--num_pages_from_user >= 0) |
178 | put_page(buf->pages[num_pages_from_user]); | 179 | put_page(buf->pages[num_pages_from_user]); |
180 | kfree(buf->pages); | ||
179 | 181 | ||
180 | userptr_fail_pages_array_alloc: | 182 | userptr_fail_pages_array_alloc: |
181 | vfree(buf->sg_desc.sglist); | 183 | vfree(buf->sg_desc.sglist); |