summaryrefslogtreecommitdiff
path: root/tests/test_stack.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-06-03 13:25:31 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-25 16:03:26 +0400
commitd13bfe0bee0d7f9c32c6f9af926ad5d829e6362d (patch)
tree9c5401be6455c14c758d05f225d013ba006012ab /tests/test_stack.c
parent2e595ad73f53910e4c6da969cab898b2a649d437 (diff)
downloadlibatomic_ops-d13bfe0bee0d7f9c32c6f9af926ad5d829e6362d.tar.gz
2011-06-03 Ivan Maidanski <ivmai@mail.ru>
* tests/test_malloc.c (run_one_test): Test AO_malloc() result (if out of memory then print the message and abort). * tests/test_stack.c (add_elements): Ditto.
Diffstat (limited to 'tests/test_stack.c')
-rw-r--r--tests/test_stack.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_stack.c b/tests/test_stack.c
index a190a78..a51d244 100644
--- a/tests/test_stack.c
+++ b/tests/test_stack.c
@@ -54,6 +54,11 @@ void add_elements(int n)
if (n == 0) return;
add_elements(n-1);
le = malloc(sizeof(list_element));
+ if (le == 0)
+ {
+ fprintf(stderr, "Out of memory\n");
+ abort();
+ }
le -> data = n;
AO_stack_push(&the_list, (AO_t *)le);
}