aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2017-04-30 13:35:17 +0200
committerDan Fandrich <dan@coneharvesters.com>2017-04-30 13:35:17 +0200
commitc0a27c5cee3c437de1629eae53d0a2c2f750488d (patch)
tree09dafd7b057cf0a4190326fa7046ab4f68f5f09b /tests/unit
parent8089dcfc5d4b34b15cee1f1cc9b3124c0279d41b (diff)
unit1604: fixed compilation under Windows, broken in the previous commit
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/unit1604.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/tests/unit/unit1604.c b/tests/unit/unit1604.c
index a7c2a2543..3c0c5d121 100644
--- a/tests/unit/unit1604.c
+++ b/tests/unit/unit1604.c
@@ -45,26 +45,28 @@ static void unit_stop(void)
static char *getflagstr(int flags)
{
char *buf = malloc(256);
- 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" : ""),
- ((flags & SANITIZE_ALLOW_RESERVED) ? "SANITIZE_ALLOW_RESERVED" : ""),
- ((flags & SANITIZE_ALLOW_TRUNCATE) ? "SANITIZE_ALLOW_TRUNCATE" : ""));
+ if(buf) {
+ snprintf(buf, 256, "%s,%s,%s,%s",
+ ((flags & SANITIZE_ALLOW_COLONS) ? "SANITIZE_ALLOW_COLONS" : ""),
+ ((flags & SANITIZE_ALLOW_PATH) ? "SANITIZE_ALLOW_PATH" : ""),
+ ((flags & SANITIZE_ALLOW_RESERVED) ? "SANITIZE_ALLOW_RESERVED" : ""),
+ ((flags & SANITIZE_ALLOW_TRUNCATE) ? "SANITIZE_ALLOW_TRUNCATE" : ""));
+ }
return buf;
}
static char *getcurlcodestr(int cc)
{
char *buf = malloc(256);
- 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" :
- cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" :
- cc == SANITIZE_ERR_OUT_OF_MEMORY ? "SANITIZE_ERR_OUT_OF_MEMORY" :
- "unexpected error code - add name"),
- cc);
+ if(buf) {
+ snprintf(buf, 256, "%s (%d)",
+ (cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" :
+ cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" :
+ cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" :
+ cc == SANITIZE_ERR_OUT_OF_MEMORY ? "SANITIZE_ERR_OUT_OF_MEMORY" :
+ "unexpected error code - add name"),
+ cc);
+ }
return buf;
}
@@ -310,8 +312,11 @@ UNITTEST_START
}
flagstr = getflagstr(data[i].flags);
+ abort_unless(flagstr, "out of memory");
received_ccstr = getcurlcodestr(res);
+ abort_unless(received_ccstr, "out of memory");
expected_ccstr = getcurlcodestr(data[i].expected_result);
+ abort_unless(expected_ccstr, "out of memory");
unitfail++;
fprintf(stderr, "\n"