[U-Boot] [PATCH v2 7/9] stdio: Fix memleak on stdio_deregister

Hans de Goede hdegoede at redhat.com
Wed Sep 24 14:06:09 CEST 2014


stdio_register makes a malloc-ed copy of struct stdio_dev through stdio_clone,
free the malloc-ed memory on stdio_deregister.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 common/stdio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/stdio.c b/common/stdio.c
index 8232815..c3ccbf5 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -197,6 +197,7 @@ int stdio_deregister_dev(struct stdio_dev *dev, int force)
 	}
 
 	list_del(&(dev->list));
+	free(dev);
 
 	/* reassign Device list */
 	list_for_each(pos, &(devs.list)) {
-- 
2.1.0



More information about the U-Boot mailing list