move the dynamic linker's jmp_buf from static to automatic storage
[musl] / src / malloc / posix_memalign.c
index 42cf274..cf67db6 100644 (file)
@@ -1,9 +1,12 @@
 #include <stdlib.h>
 #include <errno.h>
 
+void *__memalign(size_t, size_t);
+
 int posix_memalign(void **res, size_t align, size_t len)
 {
-       void *mem = aligned_alloc(align, len);
+       if (align < sizeof(void *)) return EINVAL;
+       void *mem = __memalign(align, len);
        if (!mem) return errno;
        *res = mem;
        return 0;