regex memory corruption regression test
[libc-test] / src / regression / malloc-oom.c
1 // malloc should set errno on oom
2 #include <stdlib.h>
3 #include <string.h>
4 #include <errno.h>
5 #include "test.h"
6
7 int main(void)
8 {
9         if (t_memfill() < 0)
10                 t_error("memfill failed\n");
11
12         errno = 0;
13         if (malloc(50000))
14                 t_error("malloc was successful\n");
15         if (errno != ENOMEM)
16                 t_error("expected ENOMEM, got %s\n", strerror(errno));
17
18         return t_status;
19 }