From: jsg Date: Mon, 29 Jan 2024 01:36:31 +0000 (+0000) Subject: drm/radeon/dpm: fix a memleak in sumo_parse_power_table X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=15bd7ad53e8fb474c26c057fc77396fba138cc77;p=openbsd drm/radeon/dpm: fix a memleak in sumo_parse_power_table From Zhipeng Lu a26634b3ce218ee3a308f2c0e326a1c7d4bb97ec in linux-6.6.y/6.6.14 0737df9ed0997f5b8addd6e2b9699a8c6edba2e4 in mainline linux --- diff --git a/sys/dev/pci/drm/radeon/sumo_dpm.c b/sys/dev/pci/drm/radeon/sumo_dpm.c index f74f381af05..d49c145db43 100644 --- a/sys/dev/pci/drm/radeon/sumo_dpm.c +++ b/sys/dev/pci/drm/radeon/sumo_dpm.c @@ -1493,8 +1493,10 @@ static int sumo_parse_power_table(struct radeon_device *rdev) non_clock_array_index = power_state->v2.nonClockInfoIndex; non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) &non_clock_info_array->nonClockInfo[non_clock_array_index]; - if (!rdev->pm.power_state[i].clock_info) + if (!rdev->pm.power_state[i].clock_info) { + kfree(rdev->pm.dpm.ps); return -EINVAL; + } ps = kzalloc(sizeof(struct sumo_ps), GFP_KERNEL); if (ps == NULL) { kfree(rdev->pm.dpm.ps);