Skip to contentSkip to conversation

drm/nouveau: Fix memory leak in nvbios_iccsense_parse

PATCH New zhanxin 1 participant 1 message Dec 10, 2024

Subsystems (3)
lore
Share & tools
lore

zhanxin

author
#0 lore raw

PATCH 1/1 drm/nouveau: Fix memory leak in nvbios_iccsense_parse

From 895d436242c94c56a1d696c713016cc1504b9b83 Mon Sep 17 00:00:00 2001
From: Zhanxin Qi <[email protected]>
Date: Tue, 10 Dec 2024 13:12:04 +0800
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.

---
 drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c +3 -0
index 8f0ccd3664eb..502608d575f7 100644
@@ -291,6 +291,9 @@ nvkm_iccsense_oneinit(struct nvkm_subdev *subdev)
 			list_add_tail(&rail->head, &iccsense->rails);
 		}
 	}
+
+	kfree(stbl.rail);
+
 	return 0;
 }
 
Signature · 1 line
2.30.2