drm/i915/sprite: Fix mem leak in intel_plane_init()
authorJesper Juhl <jj@chaosbits.net>
Tue, 26 Jun 2012 22:55:37 +0000 (00:55 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 27 Jun 2012 15:03:24 +0000 (17:03 +0200)
If we ever hit the default case in the switch statement we'll return
from the function without freeing the memory we just allocated to
'intel_plane' (but that has not been used).

This patch gets rid of the leak by freeing the memory just before we
return.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_sprite.c

index b04109789f2e3b48c81b0506f11b64020a1b3a36..1a1483b924d08a695a6ae4d8ed6345b626d0b085 100644 (file)
@@ -691,6 +691,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)
                break;
 
        default:
+               kfree(intel_plane);
                return -ENODEV;
        }
 
@@ -705,4 +706,3 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)
 
        return ret;
 }
-