Skip to content

Commit a5a65a7

Browse files
Abdun Nihaallag-linaro
authored andcommitted
mfd: mc13xxx-core: Fix memory leak in mc13xxx_add_subdevice_pdata()
The memory allocated for cell.name using kmemdup() is not freed when mfd_add_devices() fails. Fix that by using devm_kmemdup(). Fixes: 8e00593 ("mfd: Add mc13892 support to mc13xxx") Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in> Link: https://patch.msgid.link/20260120102622.66921-1-nihaal@cse.iitm.ac.in Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 1dfc9d6 commit a5a65a7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/mfd/mc13xxx-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ static int mc13xxx_add_subdevice_pdata(struct mc13xxx *mc13xxx,
377377
if (snprintf(buf, sizeof(buf), format, name) > sizeof(buf))
378378
return -E2BIG;
379379

380-
cell.name = kmemdup(buf, strlen(buf) + 1, GFP_KERNEL);
380+
cell.name = devm_kmemdup(mc13xxx->dev, buf, strlen(buf) + 1, GFP_KERNEL);
381381
if (!cell.name)
382382
return -ENOMEM;
383383

0 commit comments

Comments
 (0)