blob: 5f60485e9b281beb74c43c67d1ceb0092aa0e3f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
From: David Mandelin <dmandelin@mozilla.com>
diff --git a/memory/jemalloc/jemalloc.c b/memory/jemalloc/jemalloc.c
--- a/memory/jemalloc/jemalloc.c
+++ b/memory/jemalloc/jemalloc.c
@@ -5792,24 +5792,24 @@ __attribute__((noinline))
#else
inline
#endif
void *
memalign(size_t alignment, size_t size)
{
void *ret;
- assert(((alignment - 1) & alignment) == 0 && alignment >=
- sizeof(void *));
+ assert(((alignment - 1) & alignment) == 0);
if (malloc_init()) {
ret = NULL;
goto RETURN;
}
+ alignment = alignment < sizeof(void*) ? sizeof(void*) : alignment;
ret = ipalloc(alignment, size);
RETURN:
#ifdef MALLOC_XMALLOC
if (opt_xmalloc && ret == NULL) {
_malloc_message(_getprogname(),
": (malloc) Error in memalign(): out of memory\n", "", "");
abort();
|