From: Ray Strode Date: Thu, 5 Aug 2010 01:05:21 +0000 (-0400) Subject: [main] Properly handle no serial consoles X-Git-Tag: 0.8.4~174 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=234d7aa97f17ff02b9bfe3a3ad29e42227fe15ea;p=thirdparty%2Fplymouth.git [main] Properly handle no serial consoles The previous commit introduced an error where console could potentially be accessed while NULL. This commit addresses that problem. --- diff --git a/src/main.c b/src/main.c index 089f4c4d..94c0d321 100644 --- a/src/main.c +++ b/src/main.c @@ -1760,11 +1760,15 @@ check_for_consoles (state_t *state, } free (state->kernel_console_tty); + state->kernel_console_tty = NULL; - if (strcmp (console, "tty0") == 0 || strcmp (console, "/dev/tty0") == 0) - state->kernel_console_tty = strdup (default_tty); - else - state->kernel_console_tty = strdup (console); + if (console != NULL) + { + if (strcmp (console, "tty0") == 0 || strcmp (console, "/dev/tty0") == 0) + state->kernel_console_tty = strdup (default_tty); + else + state->kernel_console_tty = strdup (console); + } if (should_add_displays) {