aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/init.c
diff options
context:
space:
mode:
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