From a1b820ca0f40c816e88396bbf269d8439b54ec67 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 4 Jun 2024 16:39:39 -0300 Subject: tests/: Use freeit() and do not use NULL as a boolean false value --- tests/catalog.c | 18 +++++++++--------- tests/util.c | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/catalog.c b/tests/catalog.c index 386516e..4464fbe 100644 --- a/tests/catalog.c +++ b/tests/catalog.c @@ -145,10 +145,10 @@ test_s_print_msgs(void) { rc = 0; out: - if (str) { - free(str); + if (str != NULL) { + freeit((void *)&str); } - if (file) { + if (file != NULL) { if (fclose(file)) { logerr("fclose(): %s", strerror(errno)); rc = -1; @@ -183,10 +183,10 @@ test_s(void) { rc = 0; out: - if (str) { - free(str); + if (str != NULL) { + freeit((void *)&str); } - if (file) { + if (file != NULL) { if (fclose(file)) { logerr("fclose(): %s", strerror(errno)); rc = -1; @@ -263,10 +263,10 @@ test_s_print_msg(void) { rc = 0; out: - if (str) { - free(str); + if (str != NULL) { + freeit((void *)&str); } - if (file) { + if (file != NULL) { if (fclose(file)) { logerr("fclose(): %s", strerror(errno)); rc = -1; diff --git a/tests/util.c b/tests/util.c index cba64cf..bc85b70 100644 --- a/tests/util.c +++ b/tests/util.c @@ -96,10 +96,10 @@ test_slurp(void) { rc = 0; out: if (expected != NULL) { - free(expected); + freeit((void *)expected); } if (given != NULL) { - free(given); + freeit((void *)&given); } return rc; } -- cgit v1.2.3