diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-03-15 21:04:18 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-03-15 21:04:18 +0000 |
commit | a4edd0e946f47dfca4fe0d5ed410743bdcda131c (patch) | |
tree | 284f05cae6a302008084d96e134cb4f9ac7ffa30 | |
parent | f9ff8a7d90855a2131b2da0ec379e8e58ab07b37 (diff) | |
download | busybox-a4edd0e946f47dfca4fe0d5ed410743bdcda131c.tar.gz |
A better fix. Read nextPtr before mem gets freed.
-Erik
-rw-r--r-- | init.c | 12 | ||||
-rw-r--r-- | init/init.c | 12 |
2 files changed, 16 insertions, 8 deletions
@@ -599,7 +599,8 @@ static void check_memory() static void run_lastAction(void) { initAction *a, *tmp; - for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { + for (a = initActionList; a; a = tmp) { + tmp = a->nextPtr; if (a->action == CTRLALTDEL) { waitfor(a->process, a->console, FALSE); delete_initAction(a); @@ -938,7 +939,8 @@ extern int init_main(int argc, char **argv) /* Now run everything that needs to be run */ /* First run the sysinit command */ - for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { + for (a = initActionList; a; a = tmp) { + tmp = a->nextPtr; if (a->action == SYSINIT) { waitfor(a->process, a->console, FALSE); /* Now remove the "sysinit" entry from the list */ @@ -946,7 +948,8 @@ extern int init_main(int argc, char **argv) } } /* Next run anything that wants to block */ - for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { + for (a = initActionList; a; a = tmp) { + tmp = a->nextPtr; if (a->action == WAIT) { waitfor(a->process, a->console, FALSE); /* Now remove the "wait" entry from the list */ @@ -954,7 +957,8 @@ extern int init_main(int argc, char **argv) } } /* Next run anything to be run only once */ - for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { + for (a = initActionList; a; a = tmp) { + tmp = a->nextPtr; if (a->action == ONCE) { run(a->process, a->console, FALSE); /* Now remove the "once" entry from the list */ diff --git a/init/init.c b/init/init.c index eb1b2c505..64c7768d6 100644 --- a/init/init.c +++ b/init/init.c @@ -599,7 +599,8 @@ static void check_memory() static void run_lastAction(void) { initAction *a, *tmp; - for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { + for (a = initActionList; a; a = tmp) { + tmp = a->nextPtr; if (a->action == CTRLALTDEL) { waitfor(a->process, a->console, FALSE); delete_initAction(a); @@ -938,7 +939,8 @@ extern int init_main(int argc, char **argv) /* Now run everything that needs to be run */ /* First run the sysinit command */ - for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { + for (a = initActionList; a; a = tmp) { + tmp = a->nextPtr; if (a->action == SYSINIT) { waitfor(a->process, a->console, FALSE); /* Now remove the "sysinit" entry from the list */ @@ -946,7 +948,8 @@ extern int init_main(int argc, char **argv) } } /* Next run anything that wants to block */ - for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { + for (a = initActionList; a; a = tmp) { + tmp = a->nextPtr; if (a->action == WAIT) { waitfor(a->process, a->console, FALSE); /* Now remove the "wait" entry from the list */ @@ -954,7 +957,8 @@ extern int init_main(int argc, char **argv) } } /* Next run anything to be run only once */ - for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { + for (a = initActionList; a; a = tmp) { + tmp = a->nextPtr; if (a->action == ONCE) { run(a->process, a->console, FALSE); /* Now remove the "once" entry from the list */ |