* [PATCH] blspec: Fix crash with menu disabled
@ 2013-10-30 10:37 Sascha Hauer
2013-10-30 11:05 ` Jürgen Beisert
0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2013-10-30 10:37 UTC (permalink / raw)
To: barebox; +Cc: jbe
blspec->menu is only valid when menu support is enabled. Check for it
before dereferencing the pointer.
Signed-off-by: Sascha Hauer <s.hauer@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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] blspec: Fix crash with menu disabled
2013-10-30 10:37 [PATCH] blspec: Fix crash with menu disabled Sascha Hauer
@ 2013-10-30 11:05 ` Jürgen Beisert
0 siblings, 0 replies; 2+ messages in thread
From: Jürgen Beisert @ 2013-10-30 11:05 UTC (permalink / raw)
To: barebox
On Wednesday 30 October 2013 11:37:55 Sascha Hauer wrote:
> blspec->menu is only valid when menu support is enabled. Check for it
> before dereferencing the pointer.
>
> Signed-off-by: Sascha Hauer <s.hauer@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);
> }
Tested-by: Juergen Beisert <jbe@pengutronix.de>
--
Pengutronix e.K. | Juergen Beisert |
Linux Solutions for Science and Industry | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-30 11:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-30 10:37 [PATCH] blspec: Fix crash with menu disabled Sascha Hauer
2013-10-30 11:05 ` Jürgen Beisert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox