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)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@399098 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/98/198/1
David M. Lee 12 years ago
parent c7b56581a9
commit d867a3f062

@ -441,7 +441,7 @@ struct ao2_container *__ao2_container_alloc_debug(const unsigned int n_buckets,
/* compute the container size */
const unsigned int num_buckets = hash_fn ? n_buckets : 1;
size_t container_size = sizeof(struct ao2_container) + num_buckets * sizeof(struct bucket);
struct ao2_container *c = __ao2_alloc_debug(container_size, container_destruct_debug, tag, file, line, funcname, ref_debug);
struct ao2_container *c = __ao2_alloc_debug(container_size, ref_debug ? container_destruct_debug : container_destruct, tag, file, line, funcname, ref_debug);
return internal_ao2_container_alloc(c, num_buckets, hash_fn, cmp_fn);
}

Loading…
Cancel
Save