projects
/
libc-test
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
54fb6c0
)
regression: malloc oom errno test
author
Szabolcs Nagy
<nsz@port70.net>
Sat, 5 Oct 2013 14:05:05 +0000
(14:05 +0000)
committer
Szabolcs Nagy
<nsz@port70.net>
Sat, 5 Oct 2013 14:05:05 +0000
(14:05 +0000)
src/regression/malloc-oom.c
[new file with mode: 0644]
patch
|
blob
diff --git a/src/regression/malloc-oom.c
b/src/regression/malloc-oom.c
new file mode 100644
(file)
index 0000000..
4e40ccd
--- /dev/null
+++ b/
src/regression/malloc-oom.c
@@ -0,0
+1,19
@@
+// malloc should set errno on oom
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include "test.h"
+
+int main(void)
+{
+ if (t_vmfill(0,0,0) < 0)
+ t_error("vmfill failed: %s\n", strerror(errno));
+
+ errno = 0;
+ if (malloc(50000))
+ t_error("malloc was successful\n");
+ if (errno != ENOMEM)
+ t_error("expected ENOMEM, got %s\n", strerror(errno));
+
+ return t_status;
+}