mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 03:02:15 +00:00
Fix 3 more places where not locking the structure could cause the wrong lock to be
unlocked. (Closes issue #12795) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@123391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -8658,9 +8658,10 @@ static int iax2_do_register(struct iax2_registry *reg)
|
|||||||
* call has the pointer to IP and must be updated to the new one
|
* call has the pointer to IP and must be updated to the new one
|
||||||
*/
|
*/
|
||||||
if (reg->dnsmgr && ast_dnsmgr_changed(reg->dnsmgr) && (reg->callno > 0)) {
|
if (reg->dnsmgr && ast_dnsmgr_changed(reg->dnsmgr) && (reg->callno > 0)) {
|
||||||
ast_mutex_lock(&iaxsl[reg->callno]);
|
int callno = reg->callno;
|
||||||
iax2_destroy(reg->callno);
|
ast_mutex_lock(&iaxsl[callno]);
|
||||||
ast_mutex_unlock(&iaxsl[reg->callno]);
|
iax2_destroy(callno);
|
||||||
|
ast_mutex_unlock(&iaxsl[callno]);
|
||||||
reg->callno = 0;
|
reg->callno = 0;
|
||||||
}
|
}
|
||||||
if (!reg->addr.sin_addr.s_addr) {
|
if (!reg->addr.sin_addr.s_addr) {
|
||||||
@@ -9265,13 +9266,14 @@ static int peer_set_srcaddr(struct iax2_peer *peer, const char *srcaddr)
|
|||||||
static void peer_destructor(void *obj)
|
static void peer_destructor(void *obj)
|
||||||
{
|
{
|
||||||
struct iax2_peer *peer = obj;
|
struct iax2_peer *peer = obj;
|
||||||
|
int callno = peer->callno;
|
||||||
|
|
||||||
ast_free_ha(peer->ha);
|
ast_free_ha(peer->ha);
|
||||||
|
|
||||||
if (peer->callno > 0) {
|
if (callno > 0) {
|
||||||
ast_mutex_lock(&iaxsl[peer->callno]);
|
ast_mutex_lock(&iaxsl[callno]);
|
||||||
iax2_destroy(peer->callno);
|
iax2_destroy(callno);
|
||||||
ast_mutex_unlock(&iaxsl[peer->callno]);
|
ast_mutex_unlock(&iaxsl[callno]);
|
||||||
}
|
}
|
||||||
|
|
||||||
register_peer_exten(peer, 0);
|
register_peer_exten(peer, 0);
|
||||||
@@ -9769,12 +9771,13 @@ static void delete_users(void)
|
|||||||
while ((reg = AST_LIST_REMOVE_HEAD(®istrations, entry))) {
|
while ((reg = AST_LIST_REMOVE_HEAD(®istrations, entry))) {
|
||||||
ast_sched_del(sched, reg->expire);
|
ast_sched_del(sched, reg->expire);
|
||||||
if (reg->callno) {
|
if (reg->callno) {
|
||||||
ast_mutex_lock(&iaxsl[reg->callno]);
|
int callno = reg->callno;
|
||||||
if (iaxs[reg->callno]) {
|
ast_mutex_lock(&iaxsl[callno]);
|
||||||
iaxs[reg->callno]->reg = NULL;
|
if (iaxs[callno]) {
|
||||||
iax2_destroy(reg->callno);
|
iaxs[callno]->reg = NULL;
|
||||||
|
iax2_destroy(callno);
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&iaxsl[reg->callno]);
|
ast_mutex_unlock(&iaxsl[callno]);
|
||||||
}
|
}
|
||||||
if (reg->dnsmgr)
|
if (reg->dnsmgr)
|
||||||
ast_dnsmgr_release(reg->dnsmgr);
|
ast_dnsmgr_release(reg->dnsmgr);
|
||||||
|
Reference in New Issue
Block a user