summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2017-11-11 13:01:47 -0600
committerRichard Mudgett <rmudgett@digium.com>2017-11-11 14:46:15 -0500
commit90bb0a3e105ec1f4ae871bb37bc2890560584e3d (patch)
tree2cf09cde541d451be8e2d10ab65ead53f013eb4e /channels
parent6f1910d6ec5d73237123ce5d1b12cc78eb25f8ac (diff)
core: Add cache_media_frames debugging option.
The media frame cache gets in the way of finding use after free errors of media frames. Tools like valgrind and MALLOC_DEBUG don't know when a frame is released because it gets put into the cache instead of being freed. * Added the "cache_media_frames" option to asterisk.conf. Disabling the option helps track down media frame mismanagement when using valgrind or MALLOC_DEBUG. The cache gets in the way of determining if the frame is used after free and who freed it. NOTE: This option has no effect when Asterisk is compiled with the LOW_MEMORY compile time option enabled because the cache code does not exist. To disable the media frame cache simply disable the cache_media_frames option in asterisk.conf and restart Asterisk. Sample asterisk.conf setting: [options] cache_media_frames=no ASTERISK-27413 Change-Id: I0ab2ce0f4547cccf2eb214901835c2d951b78c00
Diffstat (limited to 'channels')
-rw-r--r--channels/iax2/parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/channels/iax2/parser.c b/channels/iax2/parser.c
index ec9d34608..6eda98260 100644
--- a/channels/iax2/parser.c
+++ b/channels/iax2/parser.c
@@ -1296,7 +1296,9 @@ void iax_frame_free(struct iax_frame *fr)
ast_atomic_fetchadd_int(&frames, -1);
#if !defined(LOW_MEMORY)
- if (!fr->cacheable || !(iax_frames = ast_threadstorage_get(&frame_cache, sizeof(*iax_frames)))) {
+ if (!fr->cacheable
+ || !ast_opt_cache_media_frames
+ || !(iax_frames = ast_threadstorage_get(&frame_cache, sizeof(*iax_frames)))) {
ast_free(fr);
return;
}