ref: 6828f8c38794f2b00fb6f3459ba4545e78c8a311
parent: c8ed006d49973bb15377d5cf4ae01898b46a72cc
author: cinap_lenrek <cinap_lenrek@rei2.9hal>
date: Mon Jan 23 00:12:05 EST 2012
fix double free in exec
--- a/sys/src/9/port/sysproc.c
+++ b/sys/src/9/port/sysproc.c
@@ -379,6 +379,8 @@
charp += n;
}
free(file0);
+ file0 = nil; /* so waserror() won't free file0 */
+ USED(file0);
free(up->text);
up->text = elem;
@@ -458,13 +460,13 @@
*/
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).
--
⑨