[asterisk-commits] mmichelson: trunk r372887 - in /trunk: ./ main/features.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 11 16:13:29 CDT 2012
Author: mmichelson
Date: Tue Sep 11 16:13:26 2012
New Revision: 372887
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=372887
Log:
Fix bad channel application data reference.
When channels get bridged due to an AMI bridge action
or a DTMF attended transfer, the two channels that
get bridged have their application data pointing to
the other channel's name. This means that if one channel
is hung up but the other moves on, it means that the
channel that moves on will have its application data
pointing at freed memory.
(issue ASTERISK-20335)
Reported by: aragon
........
Merged revisions 372840 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 372841 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 372886 from http://svn.asterisk.org/svn/asterisk/branches/11
Modified:
trunk/ (props changed)
trunk/main/features.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Modified: trunk/main/features.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/features.c?view=diff&rev=372887&r1=372886&r2=372887
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Tue Sep 11 16:13:26 2012
@@ -1087,6 +1087,33 @@
struct ast_channel *transferee, const char *type, struct ast_format_cap *cap, const char *addr,
int timeout, int *outstate, const char *language);
+static const struct ast_datastore_info channel_app_data_datastore = {
+ .type = "Channel appdata datastore",
+ .destroy = ast_free_ptr,
+};
+
+static int set_chan_app_data(struct ast_channel *chan, const char *src_app_data)
+{
+ struct ast_datastore *datastore;
+ char *dst_app_data;
+
+ datastore = ast_datastore_alloc(&channel_app_data_datastore, NULL);
+ if (!datastore) {
+ return -1;
+ }
+
+ dst_app_data = ast_malloc(strlen(src_app_data) + 1);
+ if (!dst_app_data) {
+ ast_datastore_free(datastore);
+ return -1;
+ }
+
+ ast_channel_data_set(chan, strcpy(dst_app_data, src_app_data));
+ datastore->data = dst_app_data;
+ ast_channel_datastore_add(chan, datastore);
+ return 0;
+}
+
/*!
* \brief bridge the call
* \param data thread bridge.
@@ -1106,9 +1133,13 @@
}
ast_channel_appl_set(tobj->chan, !tobj->return_to_pbx ? "Transferred Call" : "ManagerBridge");
- ast_channel_data_set(tobj->chan, ast_channel_name(tobj->peer));
+ if (set_chan_app_data(tobj->chan, ast_channel_name(tobj->peer))) {
+ ast_channel_data_set(tobj->chan, "(Empty)");
+ }
ast_channel_appl_set(tobj->peer, !tobj->return_to_pbx ? "Transferred Call" : "ManagerBridge");
- ast_channel_data_set(tobj->peer, ast_channel_name(tobj->chan));
+ if (set_chan_app_data(tobj->peer, ast_channel_name(tobj->chan))) {
+ ast_channel_data_set(tobj->peer, "(Empty)");
+ }
ast_bridge_call(tobj->peer, tobj->chan, &tobj->bconfig);
More information about the asterisk-commits
mailing list