drm/tegra: fix small leak on error in tegra_fb_alloc()
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".
Signed-off-by Dan Carpenter <[email protected]>
---
v2: tiny style changes
drivers/gpu/drm/tegra/fb.c +3 -1
@@ -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]
Thierry Reding
AppliedQuoted 5 lines · Dan Carpenter
If we don't have enough memory for ->planes then we leak "fb".
Signed-off-by Dan Carpenter <[email protected]>---
v2: tiny style changes
Applied, thanks.
Thierry