Skip to content

Commit

Permalink
[media] v4l2: vb2-dma-sg: fix memory leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrzej Pietrasiewicz authored and Mauro Carvalho Chehab committed Mar 22, 2011
1 parent 29e3fbd commit a9bb36a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/media/video/videobuf2-dma-sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -176,6 +177,7 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr,
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);
Expand Down

0 comments on commit a9bb36a

Please sign in to comment.