diff mbox

drm/i915: Plug memory leak in intel_shared_dpll_start_config()

Message ID 1415362061-31297-1-git-send-email-ander.conselvan.de.oliveira@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ander Conselvan de Oliveira Nov. 7, 2014, 12:07 p.m. UTC
The cleanup path would reset pll->new_config to NULL but wouldn't free
the allocated memory.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paulo Zanoni Nov. 7, 2014, 1:38 p.m. UTC | #1
2014-11-07 10:07 GMT-02:00 Ander Conselvan de Oliveira
<ander.conselvan.de.oliveira@intel.com>:
> The cleanup path would reset pll->new_config to NULL but wouldn't free
> the allocated memory.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

>
> Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 339e94f..7e2e4d1 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3940,6 +3940,7 @@ static int intel_shared_dpll_start_config(struct drm_i915_private *dev_priv,
>  cleanup:
>         while (--i >= 0) {
>                 pll = &dev_priv->shared_dplls[i];
> +               kfree(pll->new_config);
>                 pll->new_config = NULL;
>         }
>
> --
> 1.9.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Daniel Vetter Nov. 11, 2014, 3:15 p.m. UTC | #2
On Fri, Nov 07, 2014 at 11:38:48AM -0200, Paulo Zanoni wrote:
> 2014-11-07 10:07 GMT-02:00 Ander Conselvan de Oliveira
> <ander.conselvan.de.oliveira@intel.com>:
> > The cleanup path would reset pll->new_config to NULL but wouldn't free
> > the allocated memory.
> 
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Queued for -next, thanks for the patch.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 339e94f..7e2e4d1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3940,6 +3940,7 @@  static int intel_shared_dpll_start_config(struct drm_i915_private *dev_priv,
 cleanup:
 	while (--i >= 0) {
 		pll = &dev_priv->shared_dplls[i];
+		kfree(pll->new_config);
 		pll->new_config = NULL;
 	}