If CONFIG_CONSOLE_MUX=y and CONFIG_SYS_CONSOLE_IS_IN_ENV=n, a NULL
dereference occurs in console_devices_set().

Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com>
---
 common/console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/console.c b/common/console.c
index e4301a4932..39e1ab0e24 100644
--- a/common/console.c
+++ b/common/console.c
@@ -243,6 +243,9 @@ int cd_count[MAX_FILES];
 
 static void console_devices_set(int file, struct stdio_dev *dev)
 {
+       console_devices[file] = malloc(sizeof(struct stdio_dev *));
+       if (!console_devices[file])
+               return;
        console_devices[file][0] = dev;
        cd_count[file] = 1;
 }
-- 
2.39.2

Reply via email to