Skip to content

Commit

Permalink
drm: fb: cma: fix memory leak
Browse files Browse the repository at this point in the history
We may have a situation that the memory allocation for fbdefio fails
and then the allocation for fbops may succeed as some memory has been
freed somewhere. Lets free fbops also to face these rare situtation.
Since kfree can handle arguments as NULL, there should not be any
problem in calling both the kfree().

Signed-off-by: Sudip Mukherjee <[email protected]>
Fixes: 199c771 ("drm/fb-cma-helper: Add fb_deferred_io support")
Signed-off-by: Daniel Vetter <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
sudipm-mukherjee authored and danvet committed Jun 13, 2016
1 parent cc22a86 commit 2a92762
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/drm_fb_cma_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ static int drm_fbdev_cma_defio_init(struct fb_info *fbi,
fbops = kzalloc(sizeof(*fbops), GFP_KERNEL);
if (!fbdefio || !fbops) {
kfree(fbdefio);
kfree(fbops);
return -ENOMEM;
}

Expand Down

0 comments on commit 2a92762

Please sign in to comment.