From: Erik van der Kouwe Date: Wed, 28 Apr 2010 08:35:54 +0000 (+0000) Subject: Avoid sbrk (in favour of malloc) in RS where possible X-Git-Tag: v3.1.7~110 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/zones/static/dnssec-keyfromlabel.html?a=commitdiff_plain;h=d17590fcf4cf30ec7ae615b0912568eeaf18fb3a;p=minix.git Avoid sbrk (in favour of malloc) in RS where possible --- diff --git a/servers/rs/exec.c b/servers/rs/exec.c index c72335398..0a9a4dfaf 100644 --- a/servers/rs/exec.c +++ b/servers/rs/exec.c @@ -69,7 +69,8 @@ int srv_execve(int proc_e, char *exec, size_t exec_len, char **argv, } /* Allocate space for the stack frame. */ - if ((frame = (char *) sbrk(frame_size)) == (char *) -1) { + frame = (char *) malloc(frame_size); + if (!frame) { errno = E2BIG; return -1; } @@ -106,7 +107,7 @@ int srv_execve(int proc_e, char *exec, size_t exec_len, char **argv, r = do_exec(proc_e, exec, exec_len, progname, frame, frame_size); /* Return the memory used for the frame and exit. */ - (void) sbrk(-frame_size); + free(frame); return r; }