Skip to content

Commit ac85878

Browse files
adierkingrokhinip
authored andcommitted
Replace valloc() usages in portable code
valloc() is obsolete and 64-bit Android does not provide it at all. When portability is required, use posix_memalign() instead. Signed-off-by: Kim Topley <[email protected]>
1 parent e6b27db commit ac85878

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/io.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,10 @@ _dispatch_operation_perform(dispatch_operation_t op)
23122312
}
23132313
op->buf = _aligned_malloc(op->buf_siz, siInfo.dwPageSize);
23142314
#else
2315-
op->buf = valloc(op->buf_siz);
2315+
err = posix_memalign(&op->buf, (size_t)PAGE_SIZE, op->buf_siz);
2316+
if (err != 0) {
2317+
goto error;
2318+
}
23162319
#endif
23172320
_dispatch_op_debug("buffer allocated", op);
23182321
} else if (op->direction == DOP_DIR_WRITE) {

0 commit comments

Comments
 (0)