From: Rodrigo Kumpera Date: Tue, 22 Aug 2017 20:02:10 +0000 (-0700) Subject: [utils] Fix mono_valloc and mono_valloc_aligned malloc-based implementation. X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=98f4ec3ab64937d24bc1f1a6e9e6b5b8c604288c [utils] Fix mono_valloc and mono_valloc_aligned malloc-based implementation. --- diff --git a/mono/utils/mono-mmap.c b/mono/utils/mono-mmap.c index af8df3236f7..3fa797bbd99 100644 --- a/mono/utils/mono-mmap.c +++ b/mono/utils/mono-mmap.c @@ -380,13 +380,17 @@ mono_valloc_granule (void) void* mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type) { - return g_malloc (length); + g_assert (addr == NULL); + return mono_valloc_aligned (length, mono_pagesize (), flags, type); } void* mono_valloc_aligned (size_t size, size_t alignment, int flags, MonoMemAccountType type) { - g_assert_not_reached (); + void *res = NULL; + if (posix_memalign (&res, alignment, size)) + return NULL; + return res; } #define HAVE_VALLOC_ALIGNED