From 4c0cc292770db083116d036184cf85022c41eeea Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 5 Dec 2017 17:24:57 -0600 Subject: [PATCH] libpkgconf: pkg: add refcount debugging --- libpkgconf/pkg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index ea970b8..cc1edda 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -480,6 +480,8 @@ pkgconf_pkg_ref(const pkgconf_client_t *client, pkgconf_pkg_t *pkg) (void) client; pkg->refcount++; + PKGCONF_TRACE(client, "refcount@%p: %d", pkg, pkg->refcount); + return pkg; } @@ -498,6 +500,8 @@ void pkgconf_pkg_unref(pkgconf_client_t *client, pkgconf_pkg_t *pkg) { pkg->refcount--; + PKGCONF_TRACE(client, "refcount@%p: %d", pkg, pkg->refcount); + if (pkg->refcount <= 0) pkgconf_pkg_free(client, pkg); }