Remember to free memory.

This commit is contained in:
Emil Mikulic 2006-12-13 08:16:16 +00:00
parent a0afb2cc8b
commit d7707a9216

View File

@ -9,28 +9,21 @@ test(const char *input, const char *expected)
char *out = make_safe_uri(tmp); char *out = make_safe_uri(tmp);
if (expected == NULL) { if (expected == NULL) {
if (out == NULL) { if (out == NULL)
printf("PASS: \"%s\" is unsafe\n", input); printf("PASS: \"%s\" is unsafe\n", input);
return; else
}
else {
printf("FAIL: \"%s\" is unsafe, but got \"%s\"\n", printf("FAIL: \"%s\" is unsafe, but got \"%s\"\n",
input, out); input, out);
return;
}
} }
else if (out == NULL)
if (out == NULL) {
printf("FAIL: \"%s\" should become \"%s\", got unsafe\n", printf("FAIL: \"%s\" should become \"%s\", got unsafe\n",
input, expected); input, expected);
return; else if (strcmp(out, expected) == 0)
}
if (strcmp(out, expected) == 0)
printf("PASS: \"%s\" => \"%s\"\n", input, out); printf("PASS: \"%s\" => \"%s\"\n", input, out);
else else
printf("FAIL: \"%s\" => \"%s\", expecting \"%s\"\n", printf("FAIL: \"%s\" => \"%s\", expecting \"%s\"\n",
input, out, expected); input, out, expected);
free(tmp);
} }
static char * const tests[] = { static char * const tests[] = {