dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: Fix memory leak in nvbios_iccsense_parse
@ 2024-12-16  1:52 Zhanxin Qi
  2024-12-16  9:45 ` Danilo Krummrich
  0 siblings, 1 reply; 6+ messages in thread
From: Zhanxin Qi @ 2024-12-16  1:52 UTC (permalink / raw)
  To: kherbst, lyude, dakr, airlied, simona
  Cc: dri-devel, nouveau, linux-kernel, Zhanxin Qi

The nvbios_iccsense_parse function allocates memory for sensor data
but fails to free it when the function exits, leading to a memory
leak. Add proper cleanup to free the allocated memory.

Signed-off-by: Zhanxin Qi <zhanxin@nfschina.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
index 8f0ccd3664eb..502608d575f7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c
@@ -291,6 +291,9 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
 			list_add_tail(&rail->head, &iccsense->rails);
 		}
 	}
+
+	kfree(stbl.rail);
+
 	return 0;
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-12-17 10:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16  1:52 [PATCH] drm/nouveau: Fix memory leak in nvbios_iccsense_parse Zhanxin Qi
2024-12-16  9:45 ` Danilo Krummrich
2024-12-16 12:46   ` [PATCH v1 v1] " Zhanxin Qi
2024-12-16 13:03   ` Zhanxin Qi
2024-12-16 14:07     ` Danilo Krummrich
2024-12-17  1:53       ` [PATCH v2] " Zhanxin Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).