Merged revisions 79436 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79436 | russell | 2007-08-14 12:31:39 -0500 (Tue, 14 Aug 2007) | 3 lines

Fix some memory leaks throughout chan_iax2 related to the use of realtime.
I found these while working on iax2_peer object reference tracking.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79437 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Russell Bryant 18 years ago
parent 9ebe338bc6
commit 4e038cdc7c

@ -6015,8 +6015,11 @@ static int update_registry(struct sockaddr_in *sin, int callno, char *devtype, i
return -1;
}
ast_mutex_lock(&iaxsl[callno]);
if (!iaxs[callno])
if (!iaxs[callno]) {
if (ast_test_flag(p, IAX_TEMPONLY))
destroy_peer(p);
return -1;
}
if (ast_test_flag((&globalflags), IAX_RTUPDATE) && (ast_test_flag(p, IAX_TEMPONLY|IAX_RTCACHEFRIENDS))) {
if (sin->sin_addr.s_addr) {
@ -6054,8 +6057,11 @@ static int update_registry(struct sockaddr_in *sin, int callno, char *devtype, i
}
/* Make sure our call still exists, an INVAL at the right point may make it go away */
if (!iaxs[callno])
if (!iaxs[callno]) {
if (ast_test_flag(p, IAX_TEMPONLY))
destroy_peer(p);
return 0;
}
/* Store socket fd */
p->sockfd = fd;
@ -6140,8 +6146,11 @@ static int registry_authrequest(int callno)
ast_mutex_unlock(&iaxsl[callno]);
p = find_peer(peer_name, 1);
ast_mutex_lock(&iaxsl[callno]);
if (!iaxs[callno])
if (!iaxs[callno]) {
if (p && ast_test_flag(p, IAX_TEMPONLY))
destroy_peer(p);
return -1;
}
if (p) {
memset(&ied, 0, sizeof(ied));
iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
@ -10551,6 +10560,9 @@ static int function_iaxpeer(struct ast_channel *chan, const char *cmd, char *dat
}
}
if (ast_test_flag(peer, IAX_TEMPONLY))
destroy_peer(peer);
return 0;
}

Loading…
Cancel
Save