From 8089dcfc5d4b34b15cee1f1cc9b3124c0279d41b Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Sun, 30 Apr 2017 10:54:26 +0200 Subject: tests: fixed OOM handling of unit tests to abort test It's dangerous to continue to run the test when a memory alloc fails. --- tests/unit/unit1604.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/unit/unit1604.c') diff --git a/tests/unit/unit1604.c b/tests/unit/unit1604.c index 5f1ea9518..a7c2a2543 100644 --- a/tests/unit/unit1604.c +++ b/tests/unit/unit1604.c @@ -45,7 +45,7 @@ static void unit_stop(void) static char *getflagstr(int flags) { char *buf = malloc(256); - fail_unless(buf, "out of memory"); + abort_unless(buf, "out of memory"); snprintf(buf, 256, "%s,%s,%s,%s", ((flags & SANITIZE_ALLOW_COLONS) ? "SANITIZE_ALLOW_COLONS" : ""), ((flags & SANITIZE_ALLOW_PATH) ? "SANITIZE_ALLOW_PATH" : ""), @@ -57,7 +57,7 @@ static char *getflagstr(int flags) static char *getcurlcodestr(int cc) { char *buf = malloc(256); - fail_unless(buf, "out of memory"); + abort_unless(buf, "out of memory"); snprintf(buf, 256, "%s (%d)", (cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" : cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" : -- cgit v1.2.3