From: Dan Carpenter Date: Tue, 12 Nov 2013 10:25:26 +0000 (+0300) Subject: drm/tegra: Fix small leak on error in tegra_fb_alloc() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6b7c79d19157d52901398964ad115dd472cedfde;p=openwrt%2Fstaging%2Fblogic.git drm/tegra: Fix small leak on error in tegra_fb_alloc() If we don't have enough memory for ->planes then we leak "fb". Signed-off-by: Dan Carpenter Signed-off-by: Thierry Reding --- diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c index bd4bf210f469..f7fca09d4921 100644 --- a/drivers/gpu/drm/tegra/fb.c +++ b/drivers/gpu/drm/tegra/fb.c @@ -100,8 +100,10 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm, return ERR_PTR(-ENOMEM); fb->planes = kzalloc(num_planes * sizeof(*planes), GFP_KERNEL); - if (!fb->planes) + if (!fb->planes) { + kfree(fb); return ERR_PTR(-ENOMEM); + } fb->num_planes = num_planes;