Small fix to malloc test

This commit is contained in:
Tate, Hongliang Tian 2019-01-07 20:25:26 +08:00
parent a712bfe70a
commit cdf3a2c3e0
2 changed files with 4 additions and 4 deletions

@ -52,7 +52,7 @@ impl ProcessVM {
// No mmapped vmas initially // No mmapped vmas initially
let mmap_vmas = Vec::new(); let mmap_vmas = Vec::new();
Ok(ProcessVM { let vm = ProcessVM {
data_domain, data_domain,
code_vma, code_vma,
data_vma, data_vma,
@ -60,7 +60,8 @@ impl ProcessVM {
stack_vma, stack_vma,
mmap_vmas, mmap_vmas,
brk, brk,
}) };
Ok(vm)
} }
fn alloc_vmas(data_domain: &mut VMDomain, fn alloc_vmas(data_domain: &mut VMDomain,

@ -9,11 +9,10 @@ int main(void) {
for (size_t buf_size = MIN_SIZE; buf_size <= MAX_SIZE; buf_size *= 4) { for (size_t buf_size = MIN_SIZE; buf_size <= MAX_SIZE; buf_size *= 4) {
printf("buf_size = %lu\n", buf_size); printf("buf_size = %lu\n", buf_size);
void* buf = malloc(buf_size); void* buf = malloc(buf_size);
/* FIXME: why the first call to malloc always fail?
if (buf == NULL) { if (buf == NULL) {
printf("ERROR: failed to malloc for a buffer of %lu size\n", buf_size); printf("ERROR: failed to malloc for a buffer of %lu size\n", buf_size);
return -1;
} }
*/
free(buf); free(buf);
} }
printf("Done.\n"); printf("Done.\n");