]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Make it easier to see the ref count in a debugger
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 20 Dec 2018 00:46:06 +0000 (08:46 +0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 26 Dec 2018 01:40:34 +0000 (09:40 +0800)
src/lib/util/talloc.c

index e2ce6ced439b75fac812021987697d858edbdc3b..54d901119da7244032393481fc97dcbb76f904c9 100644 (file)
@@ -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);