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:
Mark Spencer
2005-10-23 18:11:54 +00:00
parent 60e9a6edf7
commit c3226a226a

View File

@@ -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);
}
static int get_from_jb(void *p) {
static int get_from_jb(void *p)
{
/* make sure pvt is valid! */
struct chan_iax2_pvt *pvt = p;
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);
sprintf(porta, "%d", ntohs(sin->sin_port));
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)
return NULL;