flockfile list corruption test
[libc-test.git] / src / regression / malloc-0.c
blobe354bca4f0be710dd0e3db2ccba90eddd70639af
1 // commit: 26031da0f83a2a3ed52190077931ee6c18dfd689 2011-02-20
2 // malloc(0) should return unique pointers
3 // (often expected and gnulib replaces malloc if malloc(0) returns 0)
4 #include <stdlib.h>
5 #include "test.h"
7 int main(void)
9 void *p = malloc(0);
10 void *q = malloc(0);
11 void *r = malloc(0);
12 if (!p || !q || !r)
13 t_error("malloc(0) returned NULL\n");
14 if (p == q || p == r || q == r)
15 t_error("malloc(0) returned non-unique pointers: %p, %p, %p\n", p, q, r);
16 free(q);
17 free(p);
18 free(r);
19 return t_status;