diff options
-rw-r--r-- | src/set.c | 3 | ||||
-rw-r--r-- | src/string.c | 6 | ||||
-rw-r--r-- | src/vector.c | 6 |
3 files changed, 7 insertions, 8 deletions
@@ -70,6 +70,5 @@ set_free(const struct Set **const s) { assert((*s) != NULL); const struct Vector *table = (*s)->table; vector_free(&table); - free((void *)*s); - *s = NULL; + freeit((void *)s); } diff --git a/src/string.c b/src/string.c index 7db6652..74fe2bd 100644 --- a/src/string.c +++ b/src/string.c @@ -74,9 +74,9 @@ string_new(const char *const string, const struct String **const out) { void string_free(const struct String **const s) { - free((void *)(*s)->bytes); - free((void *)(*s)); - *s = NULL; + const uint8_t *bytes = (*s)->bytes; + freeit((void *)&bytes); + freeit((void *)s); } const char * diff --git a/src/vector.c b/src/vector.c index 72b41e2..24d72b7 100644 --- a/src/vector.c +++ b/src/vector.c @@ -113,9 +113,9 @@ vector_new(const size_t value_size, const struct Vector **const out) { void vector_free(const struct Vector **const v) { assert((*v) != NULL); - free((*v)->values); - free((void *)*v); - *v = NULL; + const void **values = (*v)->values; + freeit((void *)&values); + freeit((void *)v); } size_t |