Avoid sbrk (in favour of malloc) in RS where possible

This commit is contained in:
Erik van der Kouwe 2010-04-28 08:35:54 +00:00
parent 84d404aba3
commit d17590fcf4

View file

@ -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;
}