* [PATCH] videobuf2-dma-sg: fix possible memory leak
@ 2013-11-20 21:02 Geyslan G. Bem
0 siblings, 0 replies; only message in thread
From: Geyslan G. Bem @ 2013-11-20 21:02 UTC (permalink / raw)
To: linux-kernel
Cc: kernel-br, Geyslan G. Bem, Pawel Osciak, Marek Szyprowski,
Kyungmin Park, Mauro Carvalho Chehab,
open list:VIDEOBUF2 FRAMEWORK
Fix the return when 'buf->pages' allocation error.
Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
drivers/media/v4l2-core/videobuf2-dma-sg.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c
index 2f86054..0d3a8ff 100644
--- a/drivers/media/v4l2-core/videobuf2-dma-sg.c
+++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c
@@ -178,7 +178,7 @@ static void *vb2_dma_sg_get_userptr(void *alloc_ctx, unsigned long vaddr,
buf->pages = kzalloc(buf->num_pages * sizeof(struct page *),
GFP_KERNEL);
if (!buf->pages)
- return NULL;
+ goto userptr_fail_alloc_pages;
num_pages_from_user = get_user_pages(current, current->mm,
vaddr & PAGE_MASK,
@@ -204,6 +204,7 @@ userptr_fail_get_user_pages:
while (--num_pages_from_user >= 0)
put_page(buf->pages[num_pages_from_user]);
kfree(buf->pages);
+userptr_fail_alloc_pages:
kfree(buf);
return NULL;
}
--
1.8.4.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2013-11-20 21:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-20 21:02 [PATCH] videobuf2-dma-sg: fix possible memory leak Geyslan G. Bem
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome