aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/init.c
diff options
context:
space:
mode:
authorAshwini Sharma <ak.ashwini1981.gmail.com>2014-09-18 11:47:42 -0500
committerAshwini Sharma <ak.ashwini1981.gmail.com>2014-09-18 11:47:42 -0500
commit14a11ed5ebfb2309a3fdfea1ce7a741519e44693 (patch)
tree0f9b4170a6169cece9f5ea4e7aa85ce34fe011c8 /toys/pending/init.c
parent40b20421e42cce9834d13ab52ac58efd78838ede (diff)
downloadtoybox-14a11ed5ebfb2309a3fdfea1ce7a741519e44693.tar.gz
A few fixes for issues reported in static analysis.
Diffstat (limited to 'toys/pending/init.c')
-rw-r--r--toys/pending/init.c10
1 files changed, 8 insertions, 2 deletions
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