[Asterisk-cvs] asterisk/channels chan_sip.c,1.524,1.525
markster at lists.digium.com
markster at lists.digium.com
Thu Oct 7 14:25:56 CDT 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv19041/channels
Modified Files:
chan_sip.c
Log Message:
Merge SIP memory leak fixes
Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.524
retrieving revision 1.525
diff -u -d -r1.524 -r1.525
--- chan_sip.c 7 Oct 2004 16:42:37 -0000 1.524
+++ chan_sip.c 7 Oct 2004 18:27:12 -0000 1.525
@@ -1031,6 +1031,7 @@
if (peer->pokeexpire > -1)
ast_sched_del(sched, peer->pokeexpire);
register_peer_exten(peer, 0);
+ ast_free_ha(peer->ha);
free(peer);
}
@@ -1275,10 +1276,7 @@
memcpy(&r->recv, &r->sa, sizeof(r->recv));
} else {
if (p->temponly) {
- if (p->ha) {
- ast_free_ha(p->ha);
- }
- free(p);
+ destroy_peer(p);
}
p = NULL;
}
@@ -1316,10 +1314,7 @@
return -1;
else {
if (p->temponly) {
- if (p->ha) {
- ast_free_ha(p->ha);
- }
- free(p);
+ destroy_peer(p);
}
return 0;
}
@@ -1590,6 +1585,9 @@
u->inUse++;
}
ast_mutex_unlock(&userl.lock);
+ if (u->temponly) {
+ destroy_user(u);
+ }
return -1;
}
}
@@ -1609,6 +1607,9 @@
if ( u->outUse >= u->outgoinglimit ) {
ast_log(LOG_ERROR, "Outgoing call from user '%s' rejected due to usage limit of %d\n", u->name, u->outgoinglimit);
ast_mutex_unlock(&userl.lock);
+ if (u->temponly) {
+ destroy_user(u);
+ }
return -1;
}
}
@@ -1619,6 +1620,9 @@
ast_log(LOG_ERROR, "update_user_counter(%s,%d) called with no event!\n",u->name,event);
}
ast_mutex_unlock(&userl.lock);
+ if (u->temponly) {
+ destroy_user(u);
+ }
return 0;
}
@@ -5425,6 +5429,10 @@
}
+ if (user && user->temponly) {
+ destroy_user(user);
+ }
+
return res;
}
static int check_user(struct sip_pvt *p, struct sip_request *req, char *cmd, char *uri, int reliable, struct sockaddr_in *sin, int ignore)
@@ -5738,6 +5746,10 @@
}
ast_mutex_unlock(&peerl.lock);
+
+ if (peer && peer->dynamic) {
+ destroy_peer(peer);
+ }
return RESULT_SUCCESS;
}
@@ -7882,6 +7894,10 @@
if (hp)
res = AST_DEVICE_UNKNOWN;
}
+
+ if (p && p->dynamic) {
+ destroy_peer(p);
+ }
return res;
}
@@ -8089,8 +8105,7 @@
v = v->next;
}
}
- if (oldha)
- ast_free_ha(oldha);
+ ast_free_ha(oldha);
return user;
}
@@ -8347,8 +8362,7 @@
reg_source_db(peer);
peer->delme = 0;
}
- if (oldha)
- ast_free_ha(oldha);
+ ast_free_ha(oldha);
return peer;
}
@@ -9021,12 +9035,10 @@
return -1;
}
/* Free memory for local network address mask */
- if (localaddr) {
- ast_free_ha(localaddr);
- }
- ast_mutex_destroy(&userl.lock);
- ast_mutex_destroy(&peerl.lock);
- ast_mutex_destroy(®l.lock);
+ ast_free_ha(localaddr);
+ ast_mutex_destroy(&userl.lock);
+ ast_mutex_destroy(&peerl.lock);
+ ast_mutex_destroy(®l.lock);
return 0;
}
More information about the svn-commits
mailing list