[PATCH 2/3] stringlist: Initialize HEAD str member to NULL

Sascha Hauer s.hauer at pengutronix.de
Fri Mar 5 11:03:28 GMT 2021


HEAD str member should be unused, but when it's used accidently then at
least make sure we do not use an uninitialized string.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 include/stringlist.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/stringlist.h b/include/stringlist.h
index dbf159da91..c5d6e70a36 100644
--- a/include/stringlist.h
+++ b/include/stringlist.h
@@ -19,6 +19,7 @@ void string_list_print_by_column(struct string_list *sl);
 static inline void string_list_init(struct string_list *sl)
 {
 	INIT_LIST_HEAD(&sl->list);
+	sl->str = NULL;
 }
 
 static inline void string_list_free(struct string_list *sl)
-- 
2.29.2




More information about the barebox mailing list