[PATCH] blspec: Fix crash with menu disabled

Sascha Hauer s.hauer at pengutronix.de
Wed Oct 30 06:37:55 EDT 2013


blspec->menu is only valid when menu support is enabled. Check for it
before dereferencing the pointer.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 include/blspec.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/blspec.h b/include/blspec.h
index 8422e5b..aa836e6 100644
--- a/include/blspec.h
+++ b/include/blspec.h
@@ -84,7 +84,8 @@ static inline void blspec_free(struct blspec *blspec)
 
 	list_for_each_entry_safe(entry, tmp, &blspec->entries, list)
 		blspec_entry_free(entry);
-	free(blspec->menu->display);
+	if (blspec->menu)
+		free(blspec->menu->display);
 	free(blspec->menu);
 	free(blspec);
 }
-- 
1.8.4.rc3




More information about the barebox mailing list