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-w32-a4edd0e946f47dfca4fe0d5ed410743bdcda131c.tar.gz busybox-w32-a4edd0e946f47dfca4fe0d5ed410743bdcda131c.tar.bz2 busybox-w32-a4edd0e946f47dfca4fe0d5ed410743bdcda131c.zip |
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() | |||
599 | static void run_lastAction(void) | 599 | static void run_lastAction(void) |
600 | { | 600 | { |
601 | initAction *a, *tmp; | 601 | initAction *a, *tmp; |
602 | for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { | 602 | for (a = initActionList; a; a = tmp) { |
603 | tmp = a->nextPtr; | ||
603 | if (a->action == CTRLALTDEL) { | 604 | if (a->action == CTRLALTDEL) { |
604 | waitfor(a->process, a->console, FALSE); | 605 | waitfor(a->process, a->console, FALSE); |
605 | delete_initAction(a); | 606 | delete_initAction(a); |
@@ -938,7 +939,8 @@ extern int init_main(int argc, char **argv) | |||
938 | /* Now run everything that needs to be run */ | 939 | /* Now run everything that needs to be run */ |
939 | 940 | ||
940 | /* First run the sysinit command */ | 941 | /* First run the sysinit command */ |
941 | for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { | 942 | for (a = initActionList; a; a = tmp) { |
943 | tmp = a->nextPtr; | ||
942 | if (a->action == SYSINIT) { | 944 | if (a->action == SYSINIT) { |
943 | waitfor(a->process, a->console, FALSE); | 945 | waitfor(a->process, a->console, FALSE); |
944 | /* Now remove the "sysinit" entry from the list */ | 946 | /* Now remove the "sysinit" entry from the list */ |
@@ -946,7 +948,8 @@ extern int init_main(int argc, char **argv) | |||
946 | } | 948 | } |
947 | } | 949 | } |
948 | /* Next run anything that wants to block */ | 950 | /* Next run anything that wants to block */ |
949 | for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { | 951 | for (a = initActionList; a; a = tmp) { |
952 | tmp = a->nextPtr; | ||
950 | if (a->action == WAIT) { | 953 | if (a->action == WAIT) { |
951 | waitfor(a->process, a->console, FALSE); | 954 | waitfor(a->process, a->console, FALSE); |
952 | /* Now remove the "wait" entry from the list */ | 955 | /* Now remove the "wait" entry from the list */ |
@@ -954,7 +957,8 @@ extern int init_main(int argc, char **argv) | |||
954 | } | 957 | } |
955 | } | 958 | } |
956 | /* Next run anything to be run only once */ | 959 | /* Next run anything to be run only once */ |
957 | for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { | 960 | for (a = initActionList; a; a = tmp) { |
961 | tmp = a->nextPtr; | ||
958 | if (a->action == ONCE) { | 962 | if (a->action == ONCE) { |
959 | run(a->process, a->console, FALSE); | 963 | run(a->process, a->console, FALSE); |
960 | /* Now remove the "once" entry from the list */ | 964 | /* 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() | |||
599 | static void run_lastAction(void) | 599 | static void run_lastAction(void) |
600 | { | 600 | { |
601 | initAction *a, *tmp; | 601 | initAction *a, *tmp; |
602 | for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { | 602 | for (a = initActionList; a; a = tmp) { |
603 | tmp = a->nextPtr; | ||
603 | if (a->action == CTRLALTDEL) { | 604 | if (a->action == CTRLALTDEL) { |
604 | waitfor(a->process, a->console, FALSE); | 605 | waitfor(a->process, a->console, FALSE); |
605 | delete_initAction(a); | 606 | delete_initAction(a); |
@@ -938,7 +939,8 @@ extern int init_main(int argc, char **argv) | |||
938 | /* Now run everything that needs to be run */ | 939 | /* Now run everything that needs to be run */ |
939 | 940 | ||
940 | /* First run the sysinit command */ | 941 | /* First run the sysinit command */ |
941 | for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { | 942 | for (a = initActionList; a; a = tmp) { |
943 | tmp = a->nextPtr; | ||
942 | if (a->action == SYSINIT) { | 944 | if (a->action == SYSINIT) { |
943 | waitfor(a->process, a->console, FALSE); | 945 | waitfor(a->process, a->console, FALSE); |
944 | /* Now remove the "sysinit" entry from the list */ | 946 | /* Now remove the "sysinit" entry from the list */ |
@@ -946,7 +948,8 @@ extern int init_main(int argc, char **argv) | |||
946 | } | 948 | } |
947 | } | 949 | } |
948 | /* Next run anything that wants to block */ | 950 | /* Next run anything that wants to block */ |
949 | for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { | 951 | for (a = initActionList; a; a = tmp) { |
952 | tmp = a->nextPtr; | ||
950 | if (a->action == WAIT) { | 953 | if (a->action == WAIT) { |
951 | waitfor(a->process, a->console, FALSE); | 954 | waitfor(a->process, a->console, FALSE); |
952 | /* Now remove the "wait" entry from the list */ | 955 | /* Now remove the "wait" entry from the list */ |
@@ -954,7 +957,8 @@ extern int init_main(int argc, char **argv) | |||
954 | } | 957 | } |
955 | } | 958 | } |
956 | /* Next run anything to be run only once */ | 959 | /* Next run anything to be run only once */ |
957 | for (a = tmp = initActionList; a; a = tmp = tmp->nextPtr) { | 960 | for (a = initActionList; a; a = tmp) { |
961 | tmp = a->nextPtr; | ||
958 | if (a->action == ONCE) { | 962 | if (a->action == ONCE) { |
959 | run(a->process, a->console, FALSE); | 963 | run(a->process, a->console, FALSE); |
960 | /* Now remove the "once" entry from the list */ | 964 | /* Now remove the "once" entry from the list */ |