md_size += td->o.mem_align - page_size;
if (td->o.mem_type == MEM_MALLOC) {
ld->md_buf = malloc(md_size);
- if (!ld->md_buf)
+ if (!ld->md_buf) {
+ free(ld);
return 1;
+ }
} else {
log_err("fio: Only iomem=malloc or mem=malloc is supported\n");
+ free(ld);
return 1;
}
}