From cf9c2ed0ba19c8b2109c81faa7520bc2eab189f4 Mon Sep 17 00:00:00 2001
From: Peter Limkilde Svendsen <peter.limkilde@gmail.com>
Date: Sun, 24 May 2020 18:39:53 +0200
Subject: [PATCH] Don't accept null pointer when requesting aligned memory

---
 tests/stdlib/alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/stdlib/alloc.c b/tests/stdlib/alloc.c
index c55aef5e4..366603637 100644
--- a/tests/stdlib/alloc.c
+++ b/tests/stdlib/alloc.c
@@ -31,7 +31,7 @@ void test_valid_aligned(void *ptr, size_t alignment, int error_val) {
      * address. */
     uintptr_t ptr_alignment_rem = (uintptr_t)ptr % (uintptr_t)alignment;
     
-    if (ptr_alignment_rem == 0) {
+    if (ptr != NULL && ptr_alignment_rem == 0) {
         // Constant output for successful case
         printf("pointer: (alignment OK), ");
     }
-- 
GitLab