[media] vb2: don't free alloc context if it is ERR_PTR
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 18 Nov 2014 12:51:00 +0000 (09:51 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 25 Nov 2014 10:52:18 +0000 (08:52 -0200)
Don't try to free a pointer containing an ERR_PTR().

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pawel Osciak <pawel@osciak.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/videobuf2-dma-contig.c

index c4305bf3dbedd4eab39456b3d98ebddbf309346e..0bfc488c88120059eda646764343b790cf53d5c9 100644 (file)
@@ -854,7 +854,8 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_init_ctx);
 
 void vb2_dma_contig_cleanup_ctx(void *alloc_ctx)
 {
-       kfree(alloc_ctx);
+       if (!IS_ERR_OR_NULL(alloc_ctx))
+               kfree(alloc_ctx);
 }
 EXPORT_SYMBOL_GPL(vb2_dma_contig_cleanup_ctx);