summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTest_User <hax@andrewyu.org>2023-12-14 17:05:30 -0500
committerTest_User <hax@andrewyu.org>2023-12-14 17:05:30 -0500
commit8fef1ea4dc6076f74a47a087cf3936819172926e (patch)
treec8a811376b761fbc8f5f192fadad59223f4e133d
parent8532945fa2fc05e4954cb30d8687eaadefcaaba1 (diff)
downloadcoupserv-8fef1ea4dc6076f74a47a087cf3936819172926e.tar.gz
coupserv-8fef1ea4dc6076f74a47a087cf3936819172926e.zip
yet another bug in my table code
-rw-r--r--table.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/table.c b/table.c
index d80d7fd..3e8c7f1 100644
--- a/table.c
+++ b/table.c
@@ -165,7 +165,7 @@ void * remove_table_index(struct table *tbl, struct string name) {
tbl->len--;
void *tmp = realloc(tbl->array, sizeof(*(tbl->array)) * tbl->len);
- if (tmp)
+ if (tmp || (tbl->len == 0))
tbl->array = tmp;
// else: realloc failed on shrinking... so now we have a table that's allocated a bit too big, not much of an issue