cache: set the cache_table to NULL if empty

Instead of realloc'ing to a size of 0, set the cache_table to NULL when
removing the last element from it.
Dylan Baker 2022-08-02 09:51:50 -07:00
parent d23dc2c183
commit c7b0f86815
1 changed files with 5 additions and 2 deletions

View File

@ -186,6 +186,9 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
} }
client->cache_count--; client->cache_count--;
if (client->cache_count == 0)
client->cache_table = NULL;
else
client->cache_table = pkgconf_reallocarray(client->cache_table, client->cache_table = pkgconf_reallocarray(client->cache_table,
client->cache_count, sizeof(void *)); client->cache_count, sizeof(void *));
} }