Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1706156 > unrolled thread

Re: [PATCH 1/3] thermal: core: Fix a memory leak in 'thermal_zone_device_register()' error handling path

Started byZhang Rui <rui.zhang@intel.com>
First post2017-08-08 10:40 +0200
Last post2017-08-08 10:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/3] thermal: core: Fix a memory leak in  'thermal_zone_device_register()' error handling path Zhang Rui <rui.zhang@intel.com> - 2017-08-08 10:40 +0200

#1706156 — Re: [PATCH 1/3] thermal: core: Fix a memory leak in 'thermal_zone_device_register()' error handling path

FromZhang Rui <rui.zhang@intel.com>
Date2017-08-08 10:40 +0200
SubjectRe: [PATCH 1/3] thermal: core: Fix a memory leak in 'thermal_zone_device_register()' error handling path
Message-ID<uc8dr-5nN-9@gated-at.bofh.it>
On Sun, 2017-07-16 at 08:59 +0200, Christophe JAILLET wrote:
> 'tz' is freed in some error handling paths but not in the main one.
> So free it also here to avoid a memory leak.
> 
After device registered, tz is freed in thermal_release().

thanks,
rui
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/thermal/thermal_core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/thermal/thermal_core.c
> b/drivers/thermal/thermal_core.c
> index 5a51c740e372..9743f3e65eb0 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1296,6 +1296,7 @@ thermal_zone_device_register(const char *type,
> int trips, int mask,
>  unregister:
>  	ida_simple_remove(&thermal_tz_ida, tz->id);
>  	device_unregister(&tz->device);
> +	kfree(tz);
>  	return ERR_PTR(result);
>  }
>  EXPORT_SYMBOL_GPL(thermal_zone_device_register);

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web