summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/videobuf2-dma-sg.c
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@samsung.com>2011-01-28 13:42:51 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-22 08:54:27 +0100
commita9bb36aa0d6547aa0ab3d5cfde08e8651bd460bc (patch)
treea2ee0417881a97bf76c1b400ec0721106e1bd8d7 /drivers/media/video/videobuf2-dma-sg.c
parent[media] v4l2: vb2: fix queue reallocation and REQBUFS(0) case (diff)
downloadlinux-a9bb36aa0d6547aa0ab3d5cfde08e8651bd460bc.tar.xz
linux-a9bb36aa0d6547aa0ab3d5cfde08e8651bd460bc.zip
[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.c2
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)
fail_pages_alloc:
while (--i >= 0)
__free_page(buf->pages[i]);
+ kfree(buf->pages);
fail_pages_array_alloc:
vfree(buf->sg_desc.sglist);
@@ -176,6 +177,7 @@ userptr_fail_get_user_pages:
num_pages_from_user, buf->sg_desc.num_pages);
while (--num_pages_from_user >= 0)
put_page(buf->pages[num_pages_from_user]);
+ kfree(buf->pages);
userptr_fail_pages_array_alloc:
vfree(buf->sg_desc.sglist);