mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Remember to free memory.
This commit is contained in:
parent
a0afb2cc8b
commit
d7707a9216
@ -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[] = {
|
||||||
|
Loading…
Reference in New Issue
Block a user