[Asterisk-cvs] asterisk/channels chan_sip.c,1.390,1.391
markster at lists.digium.com
markster at lists.digium.com
Sun May 16 12:20:04 CDT 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv3815/channels
Modified Files:
chan_sip.c
Log Message:
Timely packet removal and make valgrind happy
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.390
retrieving revision 1.391
diff -u -d -r1.390 -r1.391
--- chan_sip.c 16 May 2004 16:01:09 -0000 1.390
+++ chan_sip.c 16 May 2004 16:31:42 -0000 1.391
@@ -577,7 +577,7 @@
/*--- retrans_pkt: Retransmit SIP message if no answer ---*/
static int retrans_pkt(void *data)
{
- struct sip_pkt *pkt=data;
+ struct sip_pkt *pkt=data, *prev, *cur;
int res = 0;
ast_mutex_lock(&pkt->owner->lock);
if (pkt->retrans < MAX_RETRANS) {
@@ -602,17 +602,32 @@
ast_mutex_lock(&pkt->owner->lock);
}
if (pkt->owner->owner) {
- /* XXX Potential deadlocK?? XXX */
ast_queue_hangup(pkt->owner->owner);
ast_mutex_unlock(&pkt->owner->owner->lock);
} else {
/* If no owner, destroy now */
pkt->owner->needdestroy = 1;
}
- } else {
- /* Okay, it's not fatal, just continue. XXX If we were nice, we'd free it now, rather than wait for the
- end of the call XXX */
}
+ /* In any case, go ahead and remove the packet */
+ prev = NULL;
+ cur = pkt->owner->packets;
+ while(cur) {
+ if (cur == pkt)
+ break;
+ prev = cur;
+ cur = cur->next;
+ }
+ if (cur) {
+ if (prev)
+ prev->next = cur->next;
+ else
+ pkt->owner->packets = cur->next;
+ ast_mutex_unlock(&pkt->owner->lock);
+ free(cur);
+ pkt = NULL;
+ } else
+ ast_log(LOG_WARNING, "Weird, couldn't find packet owner!\n");
}
if (pkt)
ast_mutex_unlock(&pkt->owner->lock);
@@ -1503,7 +1518,7 @@
if (p->outgoing) {
transmit_request_with_auth(p, "CANCEL", p->ocseq, 1, 0);
/* Actually don't destroy us yet, wait for the 487 on our original
- INVITE, but do set an autodestruct just in case. */
+ INVITE, but do set an autodestruct just in case we never get it. */
needdestroy = 0;
sip_scheddestroy(p, 15000);
if ( p->initid != -1 ) {
@@ -2976,13 +2991,13 @@
struct sockaddr_in sin;
struct sockaddr_in vsin;
struct sip_codec_pref *cur;
- char v[256];
- char s[256];
- char o[256];
- char c[256];
- char t[256];
- char m[256];
- char m2[256];
+ char v[256] = "";
+ char s[256] = "";
+ char o[256] = "";
+ char c[256] = "";
+ char t[256] = "";
+ char m[256] = "";
+ char m2[256] = "";
char a[1024] = "";
char a2[1024] = "";
int x;
More information about the svn-commits
mailing list