summaryrefslogtreecommitdiff
path: root/sys/src/9/port/sysproc.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@rei2.9hal>2012-01-23 05:12:05 +0100
committercinap_lenrek <cinap_lenrek@rei2.9hal>2012-01-23 05:12:05 +0100
commit8ef32ed38c393cf1556dac7024f305fdae5a9b4a (patch)
treef2df4d544bcb22d569e1a12edf34b5d17058fe9f /sys/src/9/port/sysproc.c
parente2bbb41a308267c5bcc2c6a8c5224b1638a2904f (diff)
fix double free in exec
Diffstat (limited to 'sys/src/9/port/sysproc.c')
-rw-r--r--sys/src/9/port/sysproc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/src/9/port/sysproc.c b/sys/src/9/port/sysproc.c
index e4bf72335..f539cf930 100644
--- a/sys/src/9/port/sysproc.c
+++ b/sys/src/9/port/sysproc.c
@@ -379,6 +379,8 @@ sysexec(ulong *arg)
charp += n;
}
free(file0);
+ file0 = nil; /* so waserror() won't free file0 */
+ USED(file0);
free(up->text);
up->text = elem;
@@ -458,13 +460,13 @@ sysexec(ulong *arg)
*/
s = up->seg[ESEG];
up->seg[ESEG] = 0;
+ s->base = USTKTOP-USTKSIZE;
+ s->top = USTKTOP;
+ relocateseg(s, USTKTOP-TSTKTOP);
up->seg[SSEG] = s;
qunlock(&up->seglock);
poperror(); /* seglock */
poperror(); /* elem */
- s->base = USTKTOP-USTKSIZE;
- s->top = USTKTOP;
- relocateseg(s, USTKTOP-TSTKTOP);
/*
* '/' processes are higher priority (hack to make /ip more responsive).