From: Arran Cudbard-Bell Date: Thu, 20 Dec 2018 00:46:06 +0000 (+0800) Subject: Make it easier to see the ref count in a debugger X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdb7970fb21464d1e22ddbd7370711a772bd0f84;p=thirdparty%2Ffreeradius-server.git Make it easier to see the ref count in a debugger --- diff --git a/src/lib/util/talloc.c b/src/lib/util/talloc.c index e2ce6ced439..54d901119da 100644 --- a/src/lib/util/talloc.c +++ b/src/lib/util/talloc.c @@ -508,13 +508,15 @@ int talloc_memcmp_bstr(char const *a, char const *b) */ void talloc_decrease_ref_count(void const *ptr) { + size_t ref_count; void *to_free; if (!ptr) return; memcpy(&to_free, &ptr, sizeof(to_free)); - if (talloc_reference_count(to_free) == 0) { + ref_count = talloc_reference_count(to_free); + if (ref_count == 0) { talloc_free(to_free); } else { talloc_unlink(talloc_parent(ptr), to_free);