diff options
Diffstat (limited to 'arch/sandbox/cpu/start.c')
| -rw-r--r-- | arch/sandbox/cpu/start.c | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 483a2640404..c4c4128d465 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -88,7 +88,7 @@ int sandbox_early_getopt_check(void)  	/* Sort the options */  	size = sizeof(*sorted_opt) * num_options; -	sorted_opt = malloc(size); +	sorted_opt = os_malloc(size);  	if (!sorted_opt) {  		printf("No memory to sort options\n");  		os_exit(1); @@ -188,7 +188,7 @@ static int sandbox_cmdline_cb_default_fdt(struct sandbox_state *state,  	int len;  	len = strlen(state->argv[0]) + strlen(fmt) + 1; -	fname = malloc(len); +	fname = os_malloc(len);  	if (!fname)  		return -ENOMEM;  	snprintf(fname, len, fmt, state->argv[0]); @@ -208,7 +208,7 @@ static int sandbox_cmdline_cb_test_fdt(struct sandbox_state *state,  	int len;  	len = strlen(state->argv[0]) + strlen(fmt) + 1; -	fname = malloc(len); +	fname = os_malloc(len);  	if (!fname)  		return -ENOMEM;  	strcpy(fname, state->argv[0]); @@ -436,16 +436,18 @@ int main(int argc, char *argv[])  {  	struct sandbox_state *state;  	gd_t data; +	int size;  	int ret;  	/*  	 * Copy argv[] so that we can pass the arguments in the original  	 * sequence when resetting the sandbox.  	 */ -	os_argv = calloc(argc + 1, sizeof(char *)); +	size = sizeof(char *) * (argc + 1); +	os_argv = os_malloc(size);  	if (!os_argv)  		os_exit(1); -	memcpy(os_argv, argv, sizeof(char *) * (argc + 1)); +	memcpy(os_argv, argv, size);  	memset(&data, '\0', sizeof(data));  	gd = &data; | 
