[Asterisk-cvs] asterisk/channels/h323 ast_h323.cpp, 1.75,
1.76 chan_h323.h, 1.40, 1.41
jeremy at lists.digium.com
jeremy at lists.digium.com
Thu May 19 12:11:49 CDT 2005
Update of /usr/cvsroot/asterisk/channels/h323
In directory mongoose.digium.com:/tmp/cvs-serv13665
Modified Files:
ast_h323.cpp chan_h323.h
Log Message:
Fix memory leak, avoid uncessary abuse of memory and formatting tweaks. Bug #4282
Index: ast_h323.cpp
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/ast_h323.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- ast_h323.cpp 11 May 2005 13:39:33 -0000 1.75
+++ ast_h323.cpp 19 May 2005 16:16:47 -0000 1.76
@@ -434,23 +434,8 @@
*/
void MyH323EndPoint::OnConnectionCleared(H323Connection & connection, const PString & clearedCallToken)
{
- PString remoteName;
- call_details_t cd;
- PIPSocket::Address Ip;
- WORD sourcePort;
+ PString remoteName = connection.GetRemotePartyName();
- remoteName = connection.GetRemotePartyName();
- cd.call_reference = connection.GetCallReference();
- cd.call_token = strdup((const char *)clearedCallToken);
- cd.call_source_aliases = strdup((const char *)connection.GetRemotePartyName());
- connection.GetSignallingChannel()->GetRemoteAddress().GetIpAndPort(Ip, sourcePort);
- cd.sourceIp = strdup((const char *)Ip.AsString());
-
- /* Convert complex strings */
- char *s;
- if ((s = strchr(cd.call_source_aliases, ' ')) != NULL) {
- *s = '\0';
- }
switch (connection.GetCallEndReason()) {
case H323Connection::EndedByCallForwarded:
if (h323debug) {
@@ -549,7 +534,7 @@
}
}
/* Invoke the PBX application registered callback */
- on_connection_cleared(cd);
+ on_connection_cleared(connection.GetCallReference(), clearedCallToken);
return;
}
@@ -743,6 +728,7 @@
*s1 = '\0';
}
+ memset(&cd, 0, sizeof(cd));
cd.call_reference = GetCallReference();
cd.call_token = strdup((const char *)GetCallToken());
cd.call_source_aliases = strdup((const char *)sourceAliases);
@@ -755,7 +741,7 @@
cd.sourceIp = strdup((const char *)Ip.AsString());
/* Notify Asterisk of the request */
- call_options_t *res = on_incoming_call(cd);
+ call_options_t *res = on_incoming_call(&cd);
if (!res) {
if (h323debug) {
@@ -815,16 +801,16 @@
if ((s1 = strchr(destAliases, '\t')) != NULL) {
*s1 = '\0';
}
+
+ memset(&cd, 0, sizeof(cd));
cd.call_reference = GetCallReference();
- Lock();
cd.call_token = strdup((const char *)GetCallToken());
- Unlock();
cd.call_source_aliases = strdup((const char *)sourceAliases);
cd.call_dest_alias = strdup((const char *)destAliases);
cd.call_source_e164 = strdup((const char *)sourceE164);
cd.call_dest_e164 = strdup((const char *)destE164);
- int res = on_outgoing_call(cd);
+ int res = on_outgoing_call(&cd);
if (!res) {
if (h323debug) {
cout << "\t-- Call Failed" << endl;
Index: chan_h323.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/chan_h323.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- chan_h323.h 3 May 2005 15:47:35 -0000 1.40
+++ chan_h323.h 19 May 2005 16:16:47 -0000 1.41
@@ -36,7 +36,7 @@
int noFastStart;
int noH245Tunneling;
int noSilenceSuppression;
- unsigned int port;
+/* unsigned int port; */
int progress_setup;
int progress_alert;
int progress_audio;
@@ -132,12 +132,12 @@
/* This is a callback prototype function, called upon
an incoming call happens. */
-typedef call_options_t *(*setup_incoming_cb)(call_details_t);
+typedef call_options_t *(*setup_incoming_cb)(call_details_t *);
extern setup_incoming_cb on_incoming_call;
/* This is a callback prototype function, called upon
an outbound call. */
-typedef int (*setup_outbound_cb)(call_details_t);
+typedef int (*setup_outbound_cb)(call_details_t *);
extern setup_outbound_cb on_outgoing_call;
/* This is a callback prototype function, called when
@@ -152,7 +152,7 @@
/* This is a callback prototype function, called when
OnConnectionCleared callback is invoked */
-typedef void (*clear_con_cb)(call_details_t);
+typedef void (*clear_con_cb)(unsigned, const char *);
extern clear_con_cb on_connection_cleared;
/* This is a callback prototype function, called when
@@ -231,6 +231,3 @@
#ifdef __cplusplus
}
#endif
-
-
-
More information about the svn-commits
mailing list