forked from ariadne/pkgconf
pkg: assert a package being freed has 0 references
parent
0f4f170ce2
commit
283050cc42
|
@ -233,7 +233,7 @@ pkgconf_cache_free(pkgconf_client_t *client)
|
||||||
for (i = 0, count = client->cache_count; i < count; i++)
|
for (i = 0, count = client->cache_count; i < count; i++)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg = cache_table[i];
|
pkgconf_pkg_t *pkg = cache_table[i];
|
||||||
pkgconf_pkg_free(client, pkg);
|
pkgconf_pkg_unref(client, pkg);
|
||||||
}
|
}
|
||||||
free(cache_table);
|
free(cache_table);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include <libpkgconf/stdinc.h>
|
#include <libpkgconf/stdinc.h>
|
||||||
#include <libpkgconf/libpkgconf.h>
|
#include <libpkgconf/libpkgconf.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -514,6 +516,8 @@ pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
if (pkg->pc_filedir != NULL)
|
if (pkg->pc_filedir != NULL)
|
||||||
free(pkg->pc_filedir);
|
free(pkg->pc_filedir);
|
||||||
|
|
||||||
|
/* We shouldn't be trying to free this if someone is still holding a reference to it */
|
||||||
|
assert(pkg->refcount == 0);
|
||||||
free(pkg);
|
free(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue