Browse Source

Merge branch 'alignment-test-nullcheck' into 'master'

Don't accept null pointer in tests when requesting aligned memory

See merge request redox-os/relibc!272
Jeremy Soller 4 years ago
parent
commit
b2338968a2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      tests/stdlib/alloc.c

+ 1 - 1
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), ");
     }