diff --git a/libpkgconf/cache.c b/libpkgconf/cache.c index 4fe2056..03ee0e4 100644 --- a/libpkgconf/cache.c +++ b/libpkgconf/cache.c @@ -186,8 +186,11 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg) } client->cache_count--; - client->cache_table = pkgconf_reallocarray(client->cache_table, - client->cache_count, sizeof(void *)); + if (client->cache_count == 0) + client->cache_table = NULL; + else + client->cache_table = pkgconf_reallocarray(client->cache_table, + client->cache_count, sizeof(void *)); } /*