Skip to contentSkip to conversation

drm/tegra: fix small leak on error in tegra_fb_alloc()

PATCH Applied Dan Carpenter 2 participants 2 messages Nov 12, 2013 – Dec 3, 2013 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/tegra: fix small leak on error in tegra_fb_alloc()

If we don't have enough memory for ->planes then we leak "fb".

---
v2: tiny style changes

drivers/gpu/drm/tegra/fb.c +3 -1
index 490f771..f9d2de6 100644
@@ -98,8 +98,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;
 

A message that is not in the archive (sent off-list or not yet received): [email protected]