2009-12-30 01:25:53

by Darren Jenkins

[permalink] [raw]
Subject: [PATCH] drm/radeon/radeon_cp.c: fix resource leak on error

If drm_addmap() fails master_priv is leaked.


Coverity CID: 13195

Signed-off-by: Darren Jenkins <[email protected]>

diff --git drivers/gpu/drm/radeon/radeon_cp.c drivers/gpu/drm/radeon/radeon_cp.c
index 0b2f9c2..06123ba 100644
--- drivers/gpu/drm/radeon/radeon_cp.c
+++ drivers/gpu/drm/radeon/radeon_cp.c
@@ -2145,6 +2145,7 @@ int radeon_master_create(struct drm_device *dev, struct drm_master *master)
&master_priv->sarea);
if (ret) {
DRM_ERROR("SAREA setup failed\n");
+ kfree(master_priv);
return ret;
}
master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea);


2010-01-07 03:47:34

by Dave Airlie

[permalink] [raw]
Subject: Re: [PATCH] drm/radeon/radeon_cp.c: fix resource leak on error

On Wed, Dec 30, 2009 at 11:25 AM, Darren Jenkins
<[email protected]> wrote:
> If drm_addmap() fails master_priv is leaked.
>

I got a patch from Roel Kluin to fix this already, will push it out soon.

Dave.