about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/malloc/mallocng/aligned_alloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/malloc/mallocng/aligned_alloc.c b/src/malloc/mallocng/aligned_alloc.c
index 34116896..e0862a83 100644
--- a/src/malloc/mallocng/aligned_alloc.c
+++ b/src/malloc/mallocng/aligned_alloc.c
@@ -22,6 +22,9 @@ void *aligned_alloc(size_t align, size_t len)
 	if (align <= UNIT) align = UNIT;
 
 	unsigned char *p = malloc(len + align - UNIT);
+	if (!p)
+		return 0;
+
 	struct meta *g = get_meta(p);
 	int idx = get_slot_index(p);
 	size_t stride = get_stride(g);