From 8fef1ea4dc6076f74a47a087cf3936819172926e Mon Sep 17 00:00:00 2001 From: Test_User Date: Thu, 14 Dec 2023 17:05:30 -0500 Subject: yet another bug in my table code --- table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3