summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tegra
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-11-12 13:25:26 +0300
committerThierry Reding <treding@nvidia.com>2013-12-20 15:56:06 +0100
commit6b7c79d19157d52901398964ad115dd472cedfde (patch)
treec0220a19cc5436d33a61e3f47ac0942e3bb4f5cf /drivers/gpu/drm/tegra
parent60c2f709d9b41184e0279d7538a5217885da8dde (diff)
downloadop-kernel-dev-6b7c79d19157d52901398964ad115dd472cedfde.zip
op-kernel-dev-6b7c79d19157d52901398964ad115dd472cedfde.tar.gz
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 <dan.carpenter@oracle.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r--drivers/gpu/drm/tegra/fb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index bd4bf21..f7fca09 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;
OpenPOWER on IntegriCloud