[PATCH 1/2] parameter: fix memory leak

Jan Luebbe jlu at pengutronix.de
Wed Oct 10 06:42:50 EDT 2012


In __dev_add_param, the name string is allocated using strdup.
Free it when removing the parameter.

Signed-off-by: Jan Luebbe <jlu at pengutronix.de>
---
 lib/parameter.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/parameter.c b/lib/parameter.c
index 3ecb480..b33ad17 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -224,6 +224,7 @@ void dev_remove_parameters(struct device_d *dev)
 	list_for_each_entry_safe(p, n, &dev->parameters, list) {
 		p->set(dev, p, NULL);
 		list_del(&p->list);
+		free(p->name);
 		free(p);
 	}
 }
-- 
1.7.10.4




More information about the barebox mailing list