[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241216015246.141006-1-zhanxin@nfschina.com>
Date: Mon, 16 Dec 2024 09:52:46 +0800
From: Zhanxin Qi <zhanxin@...china.com>
To: kherbst@...hat.com,
lyude@...hat.com,
dakr@...hat.com,
airlied@...il.com,
simona@...ll.ch
Cc: dri-devel@...ts.freedesktop.org,
nouveau@...ts.freedesktop.org,
linux-kernel@...r.kernel.org,
Zhanxin Qi <zhanxin@...china.com>
Subject: [PATCH] drm/nouveau: Fix memory leak in nvbios_iccsense_parse
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@...china.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
Powered by blists - more mailing lists