summaryrefslogtreecommitdiff
path: root/src/vector.c
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-06-30 09:44:11 -0300
committerEuAndreh <eu@euandre.org>2024-06-30 09:44:11 -0300
commit3b47845ae1d0b832b76efdcdf2b5a9c75c5c1dda (patch)
treee0be5d88521838e1c8ea5a969a84ed9a81fee1fa /src/vector.c
parentsrc/trace.h: Fix position of TraceLevel_NONE (diff)
downloadpindaiba-3b47845ae1d0b832b76efdcdf2b5a9c75c5c1dda.tar.gz
pindaiba-3b47845ae1d0b832b76efdcdf2b5a9c75c5c1dda.tar.xz
src/vector.c: Tolerate NULL values to be given to vector_free()
Diffstat (limited to 'src/vector.c')
-rw-r--r--src/vector.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/vector.c b/src/vector.c
index 24d72b7..385e600 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -112,7 +112,14 @@ vector_new(const size_t value_size, const struct Vector **const out) {
void
vector_free(const struct Vector **const v) {
- assert((*v) != NULL);
+ if (v == NULL) {
+ return;
+ }
+
+ if (*v == NULL) {
+ return;
+ }
+
const void **values = (*v)->values;
freeit((void *)&values);
freeit((void *)v);