[asterisk-commits] russell: branch 1.4 r142063 - /branches/1.4/res/res_features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 9 10:40:25 CDT 2008


Author: russell
Date: Tue Sep  9 10:40:24 2008
New Revision: 142063

URL: http://svn.digium.com/view/asterisk?view=rev&rev=142063
Log:
Ensure that the stored CDR reference is still valid after the bridge before
poking at it.  Also, keep the channel locked while messing with this CDR.

(fixes crashes reported in issue #13409)

Modified:
    branches/1.4/res/res_features.c

Modified: branches/1.4/res/res_features.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_features.c?view=diff&rev=142063&r1=142062&r2=142063
==============================================================================
--- branches/1.4/res/res_features.c (original)
+++ branches/1.4/res/res_features.c Tue Sep  9 10:40:24 2008
@@ -1678,6 +1678,22 @@
 			ast_cdr_specialized_reset(chan->cdr,0);
 		}
 		if (peer->cdr) {
+			struct ast_cdr *cur;
+
+			ast_channel_lock(peer);
+			for (cur = peer->cdr; cur; cur = cur->next) {
+				if (cur == orig_peer_cdr) {
+					break;
+				}
+			}
+
+			if (!cur) {
+				/* orig_peer_cdr is gone, probably because of a masquerade
+				 * during the bridge. */
+				ast_channel_unlock(peer);
+				return res;
+			}
+
 			/* before resetting the peer cdr, throw a copy of it to the
 			   backend, just in case the cdr.conf file is calling for
 			   unanswered CDR's. */
@@ -1694,6 +1710,7 @@
 				}
 			}
 			ast_cdr_specialized_reset(orig_peer_cdr,0);
+			ast_channel_unlock(peer);
 		}
 	}
 	return res;




More information about the asterisk-commits mailing list