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.
parent
d23dc2c183
commit
c7b0f86815
|
@ -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 *));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue