提交 6b7c79d1 编写于 作者: D Dan Carpenter 提交者: Thierry Reding

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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NThierry Reding <treding@nvidia.com>
上级 60c2f709
...@@ -100,8 +100,10 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm, ...@@ -100,8 +100,10 @@ static struct tegra_fb *tegra_fb_alloc(struct drm_device *drm,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
fb->planes = kzalloc(num_planes * sizeof(*planes), GFP_KERNEL); fb->planes = kzalloc(num_planes * sizeof(*planes), GFP_KERNEL);
if (!fb->planes) if (!fb->planes) {
kfree(fb);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
}
fb->num_planes = num_planes; fb->num_planes = num_planes;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册