asterisk/res
Russell Bryant fbf8700c10 moh: fix a refcount error with realtime MOH
I observed a crash in res_musiconhold on an Asterisk 11 system using realtime
MOH.  Investigation of the backtrace showed a corrupt mohclass, implying that
it got destroyed before the code expected it to.  I went looking for reference
counting errors that could have caused this crash and this patch this result.
It contains 2 changes.

1) Remove a usless block of code that was impossible to reach.  There was even
a comment indicating that it was impossible to reach.  The conditional includes
"!ast_test_flag(global_flags, MOH_CACHERTCLASSES)" and it's inside of an if
block with the opposite check "ast_test_flag(global_flags,
MOH_CACHERTCLASSES)".  There's no good reason to keep it around.

2) A similar block to #1 contained a reference counting error.  It stores
state->class in the local variable mohclass without increasing its reference
count.  The reference count on mohclass is decremented at the end of the
function.  This block of code probably very rarely runs, which would help
explain why this system was working fine for many months before experiencing a
crash.

Review: https://reviewboard.asterisk.org/r/3282/
........

Merged revisions 410043 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 410044 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 410090 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-06 23:43:34 +00:00
..
ael Remove extra defines of AST_PBX_MAX_STACK. 2014-02-22 02:31:04 +00:00
ari res_stasis_recording: Add a "target_uri" field to recording events. 2014-03-06 18:20:37 +00:00
parking ao2_iterator: Mini-audit of the ao2_iterator loops in the new code files. 2013-12-20 20:00:50 +00:00
res_pjsip sorcery: Create AST_SORCERY dialplan function. 2014-03-06 22:39:54 +00:00
snmp Get the SNMP code to compile. 2013-08-02 15:01:37 +00:00
stasis res_stasis: Enable transfers and provide events when they occur. 2014-02-01 16:26:57 +00:00
stasis_recording MALLOC_DEBUG: Fix some misuses of free() when MALLOC_DEBUG is enabled. 2013-10-02 17:12:49 +00:00
ari.make ARI: Add mailboxes resource for controlling and polling external MWI 2014-01-14 23:44:57 +00:00
Makefile ARI: Implement /recordings/stored API's 2013-08-30 13:28:50 +00:00
res_adsi.c Multiple revisions 369323-369324 2012-06-25 15:55:25 +00:00
res_ael_share.c Merged revisions 328247 via svnmerge from 2011-07-14 20:28:54 +00:00
res_ael_share.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_agi.c channel locking: Add locking for channel snapshot creation 2013-12-18 20:33:37 +00:00
res_agi.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_ari.c res_ari: Make some additional error responses consistent with the rest of the system. 2014-02-26 17:04:38 +00:00
res_ari.exports.in Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
res_ari_applications.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_asterisk.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_bridges.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_channels.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_device_states.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_endpoints.c ari:Add application/json parameter support 2013-11-27 15:48:39 +00:00
res_ari_events.c ari: User better nicknames for ARI operations 2013-11-07 21:10:31 +00:00
res_ari_mailboxes.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_model.c ARI: Add subscription support 2013-10-04 16:01:48 +00:00
res_ari_model.exports.in Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
res_ari_playbacks.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_recordings.c ari:Add application/json parameter support 2013-11-27 15:48:39 +00:00
res_ari_sounds.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_calendar.c channels: Return allocated channels locked. 2013-12-18 19:28:05 +00:00
res_calendar.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_calendar_caldav.c Fix a variety of memory leaks 2012-05-18 14:43:44 +00:00
res_calendar_ews.c Properly extract the Body information of an EWS calendar item 2012-10-31 14:58:44 +00:00
res_calendar_exchange.c Add uuid wrapper API call ast_uuid_generate_str(). 2013-03-28 23:59:20 +00:00
res_calendar_icalendar.c Fix memory leak in res_calendar_icalendar 2013-01-30 14:19:29 +00:00
res_chan_stats.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00
res_clialiases.c res_clialiases: Fix crash when reloading and re-aliasing an alias that is in use. 2014-02-04 02:22:28 +00:00
res_clioriginate.c Cache string values of formats on ast_format_cap() to save processing. 2013-10-03 14:58:16 +00:00
res_config_curl.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_config_ldap.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_config_odbc.c Fix Finding Extensions With Patterns Using ODBC Realtime 2013-05-10 20:28:18 +00:00
res_config_pgsql.c res_config_pgsql: Fix ast_update2_realtime calls. 2014-02-10 16:49:40 +00:00
res_config_sqlite.c res_config_sqlite: Check for CDR unregistration failures 2013-12-08 05:59:46 +00:00
res_config_sqlite3.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_convert.c Merged revisions 328247 via svnmerge from 2011-07-14 20:28:54 +00:00
res_corosync.c Disable build of res_corosync until it is back in a compiling state 2013-08-18 02:55:54 +00:00
res_crypto.c Doxygen Updates - janitor work 2012-09-21 17:14:59 +00:00
res_crypto.exports.in Remove built-in AES code and use optional_api instead 2010-07-21 19:11:32 +00:00
res_curl.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_fax.c json: Fix off-nominal json ref counting issues. 2014-02-21 18:04:54 +00:00
res_fax.exports.in Log spandsp's fax debug output to the FAX logger level. 2010-05-21 15:15:58 +00:00
res_fax_spandsp.c res_fax_spandsp: Fix crash when passing ulaw/alaw data to spandsp 2014-03-06 02:22:59 +00:00
res_format_attr_celt.c Add support for parsing SDP attributes, generating SDP attributes, and passing it through. 2012-07-13 16:49:40 +00:00
res_format_attr_h263.c Reduce memory consumption and add the H.264 and H.263 modules I shamefully neglected to add. 2012-07-13 18:41:07 +00:00
res_format_attr_h264.c AST-2013-001: Prevent buffer overflow through H.264 format negotiation 2013-03-27 14:28:36 +00:00
res_format_attr_opus.c Add pass through support for Opus and VP8; Opus format attribute negotiation 2013-08-23 15:42:27 +00:00
res_format_attr_silk.c Add support for parsing SDP attributes, generating SDP attributes, and passing it through. 2012-07-13 16:49:40 +00:00
res_http_post.c Avoid cppcheck warnings; removing unused vars and a bit of cleanup. 2012-04-17 18:57:40 +00:00
res_http_websocket.c Fix res/res_http_websocket.c build failure in 32bit due to incorrect print format for uint64_t 2014-03-05 16:26:38 +00:00
res_http_websocket.exports.in Shuffle RESTful URL's around. 2013-07-03 16:32:00 +00:00
res_jabber.c Voicemail: Remove mailbox identifier format (box@context) assumptions in the system. 2013-12-19 16:52:43 +00:00
res_jabber.exports.in Fix chan_jingle/gtalk load regression introduced in r346087 2011-12-05 14:47:11 +00:00
res_limit.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_monitor.c Update Asterisk's CDRs for the new bridging framework 2013-06-17 03:00:38 +00:00
res_monitor.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_musiconhold.c moh: fix a refcount error with realtime MOH 2014-03-06 23:43:34 +00:00
res_mutestream.c ARI: Add support for suppressing media streams. 2013-07-18 16:03:12 +00:00
res_mwi_external.c External MWI core support. 2014-01-06 17:45:25 +00:00
res_mwi_external.exports.in External MWI core support. 2014-01-06 17:45:25 +00:00
res_mwi_external_ami.c External MWI AMI support. 2014-01-06 17:49:05 +00:00
res_odbc.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_odbc.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_parking.c res_parking: Update XML documention for DTMF features after parking timeout. 2013-10-22 16:28:05 +00:00
res_phoneprov.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_pjsip.c sorcery: Create sorcery instance registry. 2014-02-20 20:45:30 +00:00
res_pjsip.exports.in res_pjsip: AMI commands and events. 2013-11-23 17:26:57 +00:00
res_pjsip_acl.c sorcery: Create AST_SORCERY dialplan function. 2014-03-06 22:39:54 +00:00
res_pjsip_authenticator_digest.c res_pjsip_authenticator_digest: Fix md5 hash buffer 2014-01-03 21:13:30 +00:00
res_pjsip_caller_id.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_diversion.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_dtmf_info.c Prevent a crash in res_pjsip_dtmf_info.c 2013-09-03 18:09:02 +00:00
res_pjsip_endpoint_identifier_anonymous.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_endpoint_identifier_ip.c sorcery: Create AST_SORCERY dialplan function. 2014-03-06 22:39:54 +00:00
res_pjsip_endpoint_identifier_user.c PJSIP: Add log messages when requests are received for non-existent endpoints 2013-10-25 17:41:38 +00:00
res_pjsip_exten_state.c res_pjsip_exten_state: Presence for digium phones 2014-02-25 17:51:51 +00:00
res_pjsip_exten_state.exports.in The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_header_funcs.c res_pjsip_send_to_voicemail: transferring to voicemail for digium phones 2014-02-25 17:47:06 +00:00
res_pjsip_log_forwarder.c res_pjsip: Forward PJSIP logging to Asterisk logging 2013-09-13 14:22:07 +00:00
res_pjsip_logger.c res_pjsip: Updates and adds more PJSIP CLI commands. 2014-02-06 17:55:45 +00:00
res_pjsip_messaging.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_mwi.c Don't attempt to link in an aggregate MWI subscription if an endpoint does not aggregate MWI. 2014-03-06 15:58:13 +00:00
res_pjsip_mwi_body_generator.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_nat.c PJSIP: Fix address for ACK in NAT situations 2014-01-31 15:08:49 +00:00
res_pjsip_notify.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_one_touch_record_info.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_outbound_authenticator_digest.c Switch PJSIP auth to use a vector. 2013-12-09 16:10:05 +00:00
res_pjsip_outbound_registration.c sorcery: Create AST_SORCERY dialplan function. 2014-03-06 22:39:54 +00:00
res_pjsip_path.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_pidf_body_generator.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_pidf_digium_body_supplement.c res_pjsip_exten_state: Presence for digium phones 2014-02-25 17:51:51 +00:00
res_pjsip_pidf_eyebeam_body_supplement.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_pubsub.c Remove all PJSIP MWI-specific use from our MWI code. 2014-02-13 18:52:08 +00:00
res_pjsip_pubsub.exports.in Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_refer.c PJSIP: Prevent crash if channel has gone away 2014-02-26 13:45:12 +00:00
res_pjsip_registrar.c Store SIP User-Agent information in contacts. 2014-02-17 15:36:45 +00:00
res_pjsip_registrar_expire.c sorcery, bucket: Change observer remove calls to take const callbacks struct. 2013-12-03 17:35:54 +00:00
res_pjsip_rfc3326.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_sdp_rtp.c res_pjsip_sdp_rtp: Apply packetization rules on inbound SDP handling 2014-02-27 12:29:56 +00:00
res_pjsip_send_to_voicemail.c res_pjsip_send_to_voicemail: transferring to voicemail for digium phones 2014-02-25 17:47:06 +00:00
res_pjsip_session.c res_pjsip_session: Set options (100rel, timers) on incoming sessions. 2014-03-01 20:28:04 +00:00
res_pjsip_session.exports.in The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_t38.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_transport_websocket.c res_pjsip_transport_websocket: Fix security events and simplify implementation. 2013-12-01 19:58:08 +00:00
res_pjsip_xpidf_body_generator.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pktccops.c Fix compilation on gcc 4.8.1 2013-07-30 13:46:16 +00:00
res_pktccops.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_realtime.c Cleanup references to sipusers and sipfriends dynamic realtime families 2011-11-01 19:53:26 +00:00
res_rtp_asterisk.c res_rtp_asterisk: Fix one way audio problems with hold/unhold when using ICE 2014-03-04 17:22:32 +00:00
res_rtp_multicast.c res_rtp_multicast: Ensure SSRC is set properly 2013-10-03 18:32:59 +00:00
res_security_log.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00
res_smdi.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_smdi.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_snmp.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_sorcery_astdb.c json: Fix off-nominal json ref counting issues. 2014-02-21 18:04:54 +00:00
res_sorcery_config.c res_sorcery_config: Output an error message when an object can't be created. 2013-12-17 18:35:39 +00:00
res_sorcery_memory.c Pass the sorcery instance to wizards for CUD operations as well as retrieve. 2013-03-20 14:52:23 +00:00
res_sorcery_realtime.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_speech.c Add support for retrieving engine specific settings using the speech API and from dialplan. 2012-10-01 12:29:04 +00:00
res_speech.exports.in app_speech_utils: Fix unresolved symbol ast_speech_get_setting(). 2013-09-16 18:00:32 +00:00
res_srtp.c Use srtp_shutdown when available 2013-05-15 12:42:04 +00:00
res_srtp.exports.in Add SRTP support for Asterisk 2010-06-08 05:29:08 +00:00
res_stasis.c res_stasis: Enable transfers and provide events when they occur. 2014-02-01 16:26:57 +00:00
res_stasis.exports.in Moved core logic from app_stasis to res_stasis 2013-04-15 16:43:47 +00:00
res_stasis_answer.c ARI: Adding a channel to a bridge while a live recording is active blocks 2013-12-13 16:38:57 +00:00
res_stasis_answer.exports.in Add missing exports file 2013-05-20 14:21:39 +00:00
res_stasis_device_state.c ARI: Make double subscribe respond with success 2014-01-28 19:19:08 +00:00
res_stasis_device_state.exports.in ARI: Implement device state API 2013-11-23 17:48:28 +00:00
res_stasis_mailbox.c ARI: Add mailboxes resource for controlling and polling external MWI 2014-01-14 23:44:57 +00:00
res_stasis_mailbox.exports.in ARI: Add mailboxes resource for controlling and polling external MWI 2014-01-14 23:44:57 +00:00
res_stasis_playback.c res_stasis_playback: Correct error argument order 2014-01-22 14:01:07 +00:00
res_stasis_playback.exports.in This patch implements the REST API's for POST /channels/{channelId}/play 2013-05-23 20:11:35 +00:00
res_stasis_recording.c res_stasis_recording: Add a "target_uri" field to recording events. 2014-03-06 18:20:37 +00:00
res_stasis_recording.exports.in ARI - channel recording support 2013-07-03 17:58:45 +00:00
res_stasis_snoop.c channels: Return allocated channels locked. 2013-12-18 19:28:05 +00:00
res_stasis_snoop.exports.in ari: Add Snoop operation for spying/whispering on channels. 2013-11-23 12:40:46 +00:00
res_stasis_test.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00
res_stasis_test.exports.in Initial support for endpoints. 2013-05-08 13:39:08 +00:00
res_statsd.c Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
res_statsd.exports.in Example of how to use the Stasis message bus 2013-04-26 20:05:15 +00:00
res_stun_monitor.c Move channel driver Registry manager events to core. 2013-07-08 14:42:57 +00:00
res_timing_dahdi.c timing: Improve performance for most timing implementations. 2014-02-07 20:01:45 +00:00
res_timing_kqueue.c timing: Improve performance for most timing implementations. 2014-02-07 20:01:45 +00:00
res_timing_pthread.c timing: Improve performance for most timing implementations. 2014-02-07 20:01:45 +00:00
res_timing_timerfd.c timing: Improve performance for most timing implementations. 2014-02-07 20:01:45 +00:00
res_xmpp.c Voicemail: Remove mailbox identifier format (box@context) assumptions in the system. 2013-12-19 16:52:43 +00:00
res_xmpp.exports.in Add a new unified Jingle, Google Jingle, and Google Talk channel driver written from scratch called chan_motif. 2012-07-07 17:06:51 +00:00