mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-21 20:56:39 +00:00
Fix segfault when building peer based on IP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6846 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -2129,7 +2129,8 @@ static void update_jbsched(struct chan_iax2_pvt *pvt) {
|
|||||||
pvt->jbid = ast_sched_add(sched, when, get_from_jb, (void *)pvt);
|
pvt->jbid = ast_sched_add(sched, when, get_from_jb, (void *)pvt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_from_jb(void *p) {
|
static int get_from_jb(void *p)
|
||||||
|
{
|
||||||
/* make sure pvt is valid! */
|
/* make sure pvt is valid! */
|
||||||
struct chan_iax2_pvt *pvt = p;
|
struct chan_iax2_pvt *pvt = p;
|
||||||
struct iax_frame *fr;
|
struct iax_frame *fr;
|
||||||
@@ -2533,6 +2534,15 @@ static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in
|
|||||||
ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr);
|
ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr);
|
||||||
sprintf(porta, "%d", ntohs(sin->sin_port));
|
sprintf(porta, "%d", ntohs(sin->sin_port));
|
||||||
var = ast_load_realtime("iaxpeers", "ipaddr", iabuf, "port", porta, NULL);
|
var = ast_load_realtime("iaxpeers", "ipaddr", iabuf, "port", porta, NULL);
|
||||||
|
if (var) {
|
||||||
|
/* We'll need the peer name in order to build the structure! */
|
||||||
|
tmp = var;
|
||||||
|
while(tmp) {
|
||||||
|
if (!strcasecmp(tmp->name, "name"))
|
||||||
|
peername = tmp->value;
|
||||||
|
tmp = tmp->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!var)
|
if (!var)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Reference in New Issue
Block a user