[PATCH] drm/nouveau/iccsense: fix memory leak on default sensor->type case

Ben Skeggs skeggsb at gmail.com
Thu Jun 2 22:28:27 UTC 2016


On 06/02/2016 08:28 PM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
> 
> The default sensor->type case leaks memory allocated to rail. Fix
> this by free'ing rail before we continue with the next loop iteration.
This doesn't completely fix the issue, as there are continue statements
in other sections of the code that can leak also.

That said, I already have a patch fixing this issue in a branch I
haven't pushed as of yet, I'll split it out later today.

Thanks,
Ben.

> 
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
>  drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
> index 323c79a..79b0eb5 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
> @@ -305,6 +305,7 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
>  			rail->read = nvkm_iccsense_ina3221_read;
>  			break;
>  		default:
> +			kfree(rail);
>  			continue;
>  		}
>  
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20160603/aa17fed2/attachment.sig>


More information about the dri-devel mailing list