forked from ariadne/pkgconf
dependency: assert that there is never a negative number of references
parent
f809e0978e
commit
798f2dac74
|
@ -16,6 +16,8 @@
|
||||||
#include <libpkgconf/stdinc.h>
|
#include <libpkgconf/stdinc.h>
|
||||||
#include <libpkgconf/libpkgconf.h>
|
#include <libpkgconf/libpkgconf.h>
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -244,8 +246,9 @@ pkgconf_dependency_unref(pkgconf_client_t *client, pkgconf_dependency_t *dep)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dep->refcount--;
|
dep->refcount--;
|
||||||
|
assert(dep->refcount >= 0);
|
||||||
PKGCONF_TRACE(client, "%s: refcount@%p: %d", dep->package, dep, dep->refcount);
|
PKGCONF_TRACE(client, "%s: refcount@%p: %d", dep->package, dep, dep->refcount);
|
||||||
if (dep->refcount <= 0)
|
if (dep->refcount == 0)
|
||||||
pkgconf_dependency_free_one(dep);
|
pkgconf_dependency_free_one(dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue