From d7707a9216c544df5526b5db151a70707096dea7 Mon Sep 17 00:00:00 2001 From: Emil Mikulic Date: Wed, 13 Dec 2006 08:16:16 +0000 Subject: [PATCH] Remember to free memory. --- test_make_safe_uri.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/test_make_safe_uri.c b/test_make_safe_uri.c index f5f1c0b..0934022 100644 --- a/test_make_safe_uri.c +++ b/test_make_safe_uri.c @@ -9,28 +9,21 @@ test(const char *input, const char *expected) char *out = make_safe_uri(tmp); if (expected == NULL) { - if (out == NULL) { + if (out == NULL) printf("PASS: \"%s\" is unsafe\n", input); - return; - } - else { + else printf("FAIL: \"%s\" is unsafe, but got \"%s\"\n", input, out); - return; - } } - - if (out == NULL) { + else if (out == NULL) printf("FAIL: \"%s\" should become \"%s\", got unsafe\n", input, expected); - return; - } - - if (strcmp(out, expected) == 0) + else if (strcmp(out, expected) == 0) printf("PASS: \"%s\" => \"%s\"\n", input, out); else printf("FAIL: \"%s\" => \"%s\", expecting \"%s\"\n", input, out, expected); + free(tmp); } static char * const tests[] = {