[PATCH 7/7] cdev: fix string leaks in devfs links
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Nov 25 07:29:27 PST 2024
The name and part of devfs links are always dynamically allocated, so
make sure to free them once we are done with them.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
fs/devfs-core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 0bb363d0a9ff..0651be3d8fc4 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -428,8 +428,11 @@ int devfs_remove(struct cdev *cdev)
if (cdev_is_partition(cdev))
list_del(&cdev->partition_entry);
- if (cdev->link)
+ if (cdev->link) {
+ free(cdev->name);
+ free(cdev->partname);
free(cdev);
+ }
return 0;
}
--
2.39.5
More information about the barebox
mailing list