summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-06-04 16:39:39 -0300
committerEuAndreh <eu@euandre.org>2024-06-04 16:41:07 -0300
commita1b820ca0f40c816e88396bbf269d8439b54ec67 (patch)
tree49d63235964e21bbd5d3196164738bf139c677ac
parentsrc/: Use freeit() for set_free(), string_free() and vector_free() (diff)
downloadpindaiba-a1b820ca0f40c816e88396bbf269d8439b54ec67.tar.gz
pindaiba-a1b820ca0f40c816e88396bbf269d8439b54ec67.tar.xz
tests/: Use freeit() and do not use NULL as a boolean false value
-rw-r--r--tests/catalog.c18
-rw-r--r--tests/util.c4
2 files changed, 11 insertions, 11 deletions
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;
}