fix double free in exec
This commit is contained in:
parent
e2bbb41a30
commit
8ef32ed38c
|
@ -379,6 +379,8 @@ sysexec(ulong *arg)
|
||||||
charp += n;
|
charp += n;
|
||||||
}
|
}
|
||||||
free(file0);
|
free(file0);
|
||||||
|
file0 = nil; /* so waserror() won't free file0 */
|
||||||
|
USED(file0);
|
||||||
|
|
||||||
free(up->text);
|
free(up->text);
|
||||||
up->text = elem;
|
up->text = elem;
|
||||||
|
@ -458,13 +460,13 @@ sysexec(ulong *arg)
|
||||||
*/
|
*/
|
||||||
s = up->seg[ESEG];
|
s = up->seg[ESEG];
|
||||||
up->seg[ESEG] = 0;
|
up->seg[ESEG] = 0;
|
||||||
|
s->base = USTKTOP-USTKSIZE;
|
||||||
|
s->top = USTKTOP;
|
||||||
|
relocateseg(s, USTKTOP-TSTKTOP);
|
||||||
up->seg[SSEG] = s;
|
up->seg[SSEG] = s;
|
||||||
qunlock(&up->seglock);
|
qunlock(&up->seglock);
|
||||||
poperror(); /* seglock */
|
poperror(); /* seglock */
|
||||||
poperror(); /* elem */
|
poperror(); /* elem */
|
||||||
s->base = USTKTOP-USTKSIZE;
|
|
||||||
s->top = USTKTOP;
|
|
||||||
relocateseg(s, USTKTOP-TSTKTOP);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* '/' processes are higher priority (hack to make /ip more responsive).
|
* '/' processes are higher priority (hack to make /ip more responsive).
|
||||||
|
|
Loading…
Reference in a new issue