about summary refs log tree commit diff
path: root/src/malloc/memalign.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/malloc/memalign.c')
-rw-r--r--src/malloc/memalign.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/malloc/memalign.c b/src/malloc/memalign.c
index 006bd21c..35b67599 100644
--- a/src/malloc/memalign.c
+++ b/src/malloc/memalign.c
@@ -3,9 +3,7 @@
 #include <errno.h>
 #include "libc.h"
 
-/* This function should work with most dlmalloc-like chunk bookkeeping
- * systems, but it's only guaranteed to work with the native implementation
- * used in this library. */
+void __internal_free(void *);
 
 void *__memalign(size_t align, size_t len)
 {
@@ -17,7 +15,7 @@ void *__memalign(size_t align, size_t len)
 		return NULL;
 	}
 
-	if (len > SIZE_MAX - align) {
+	if (len > SIZE_MAX - align || free != __internal_free) {
 		errno = ENOMEM;
 		return NULL;
 	}