summaryrefslogtreecommitdiff
path: root/main/astobj2.c
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-09-13 20:55:09 +0000
committerDavid M. Lee <dlee@digium.com>2013-09-13 20:55:09 +0000
commit03c7857375b475883a81141da05ca2d2376bf066 (patch)
tree5530c6aee1dbe9ab83fc4bf5d130e37591d20c0f /main/astobj2.c
parent9deb416397ff8df1fe9a4bd13da88c7bb6002db8 (diff)
Don't write to /tmp/refs when REF_DEBUG is not defined.
If MALLOC_DEBUG is enabled, then the debug destructor for the container is used, which would erroneously write to /tmp/refs. This patch only uses the debug destructor if ref_debug is used. (closes issue ASTERISK-22536) ........ Merged revisions 399098 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 399099 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 399100 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399101 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/astobj2.c')
-rw-r--r--main/astobj2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/astobj2.c b/main/astobj2.c
index 5cb3ee3d5..cc1e2576b 100644
--- a/main/astobj2.c
+++ b/main/astobj2.c
@@ -3190,7 +3190,8 @@ struct ao2_container *__ao2_container_alloc_hash_debug(unsigned int ao2_options,
num_buckets = hash_fn ? n_buckets : 1;
container_size = sizeof(struct ao2_container_hash) + num_buckets * sizeof(struct hash_bucket);
- self = __ao2_alloc_debug(container_size, container_destruct_debug, ao2_options,
+ self = __ao2_alloc_debug(container_size,
+ ref_debug ? container_destruct_debug : container_destruct, ao2_options,
tag, file, line, func, ref_debug);
return hash_ao2_container_init(self, container_options, num_buckets, hash_fn,
sort_fn, cmp_fn);
@@ -5337,7 +5338,8 @@ struct ao2_container *__ao2_container_alloc_rbtree_debug(unsigned int ao2_option
return NULL;
}
- self = __ao2_alloc_debug(sizeof(*self), container_destruct_debug, ao2_options,
+ self = __ao2_alloc_debug(sizeof(*self),
+ ref_debug ? container_destruct_debug : container_destruct, ao2_options,
tag, file, line, func, ref_debug);
return rb_ao2_container_init(self, container_options, sort_fn, cmp_fn);
}