mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
immediately handle a memory allocation failure so the rest of the function
doesn't have to be indented (indentation still to be fixed) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -4177,8 +4177,10 @@ static void build_peer(dundi_eid *eid, struct ast_variable *v, int *globalpcmode
|
|||||||
}
|
}
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
/* Add us into the list */
|
/* Add us into the list */
|
||||||
peer = ast_calloc(1, sizeof(*peer));
|
if (!(peer = ast_calloc(1, sizeof(*peer)))) {
|
||||||
if (peer) {
|
AST_LIST_UNLOCK(&peers);
|
||||||
|
return;
|
||||||
|
}
|
||||||
peer->registerid = -1;
|
peer->registerid = -1;
|
||||||
peer->registerexpire = -1;
|
peer->registerexpire = -1;
|
||||||
peer->qualifyid = -1;
|
peer->qualifyid = -1;
|
||||||
@@ -4186,9 +4188,7 @@ static void build_peer(dundi_eid *eid, struct ast_variable *v, int *globalpcmode
|
|||||||
peer->addr.sin_port = htons(DUNDI_PORT);
|
peer->addr.sin_port = htons(DUNDI_PORT);
|
||||||
populate_addr(peer, eid);
|
populate_addr(peer, eid);
|
||||||
AST_LIST_INSERT_HEAD(&peers, peer, list);
|
AST_LIST_INSERT_HEAD(&peers, peer, list);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (peer) {
|
|
||||||
peer->dead = 0;
|
peer->dead = 0;
|
||||||
peer->eid = *eid;
|
peer->eid = *eid;
|
||||||
peer->us_eid = global_eid;
|
peer->us_eid = global_eid;
|
||||||
@@ -4308,7 +4308,6 @@ static void build_peer(dundi_eid *eid, struct ast_variable *v, int *globalpcmode
|
|||||||
}
|
}
|
||||||
qualify_peer(peer, 1);
|
qualify_peer(peer, 1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
AST_LIST_UNLOCK(&peers);
|
AST_LIST_UNLOCK(&peers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user