Check for malloc failure
This commit is contained in:
parent
9e35e00500
commit
57920c9aa4
@ -151,6 +151,8 @@ errval_t aos_urpc_get_bootinfo(struct aos_urpc * rpc, struct bootinfo_serialized
|
|||||||
}
|
}
|
||||||
|
|
||||||
*ret = malloc(ret_len);
|
*ret = malloc(ret_len);
|
||||||
|
if (*ret == NULL) return LIB_ERR_MALLOC_FAIL;
|
||||||
|
|
||||||
memcpy(*ret, rpc->shared_mem, ret_len);
|
memcpy(*ret, rpc->shared_mem, ret_len);
|
||||||
return SYS_ERR_OK;
|
return SYS_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,6 +176,7 @@ static errval_t deserialize_bootinfo(struct bootinfo_serialized * serialized, st
|
|||||||
// err = paging_map_frame(get_current_paging_state(), (void **) ret, bootinfo_size, ret_frame);
|
// err = paging_map_frame(get_current_paging_state(), (void **) ret, bootinfo_size, ret_frame);
|
||||||
// if (err_is_fail(err)) return err_push(err, LIB_ERR_PMAP_MAP);
|
// if (err_is_fail(err)) return err_push(err, LIB_ERR_PMAP_MAP);
|
||||||
*ret = malloc(bootinfo_size);
|
*ret = malloc(bootinfo_size);
|
||||||
|
if(*ret == NULL) return LIB_ERR_MALLOC_FAIL;
|
||||||
|
|
||||||
(*ret)->host_msg = serialized->host_msg;
|
(*ret)->host_msg = serialized->host_msg;
|
||||||
(*ret)->host_msg_bits = serialized->host_msg_bits;
|
(*ret)->host_msg_bits = serialized->host_msg_bits;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user