[PATCH 04/12] file_list: Fix memory leak in failure path

Sascha Hauer s.hauer at pengutronix.de
Wed Sep 27 05:09:02 PDT 2017


In case of a parse error not only the list header has to be freed, but
also the entries. Use file_list_free() for this purpose.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/file-list.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/file-list.c b/common/file-list.c
index e13d5af659..be8f53bd89 100644
--- a/common/file-list.c
+++ b/common/file-list.c
@@ -122,7 +122,7 @@ struct file_list *file_list_parse(const char *str)
 
 	return files;
 out:
-	free(files);
+	file_list_free(files);
 
 	return ERR_PTR(ret);
 }
-- 
2.11.0




More information about the barebox mailing list