From 14a11ed5ebfb2309a3fdfea1ce7a741519e44693 Mon Sep 17 00:00:00 2001 From: Ashwini Sharma Date: Thu, 18 Sep 2014 11:47:42 -0500 Subject: A few fixes for issues reported in static analysis. --- toys/pending/init.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'toys/pending/init.c') diff --git a/toys/pending/init.c b/toys/pending/init.c index ca3c6cc4..529c1b9e 100644 --- a/toys/pending/init.c +++ b/toys/pending/init.c @@ -141,6 +141,8 @@ static void inittab_parsing(void) line_number++; token_count = 0; action = 0; + tty_name = command = NULL; + while ((extracted_token = strsep(&p,":"))) { token_count++; switch (token_count) { @@ -172,8 +174,12 @@ static void inittab_parsing(void) } //while token if (q) free(q); - if (token_count != 4) continue; - if (action) add_new_action(action, command, tty_name); + if (token_count != 4) { + free(tty_name); + free(command); + continue; + } + if (action) add_new_action(action, command, tty_name); free(tty_name); free(command); } //while line -- cgit v1.2.3