From 4b4fb6bb2cee53779053874d7f0969fa51e18813 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 2 Jun 2009 18:30:18 +0000 Subject: [PATCH] rupa said this segged git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13550 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index 505c85cbd5..2ac36a7ad4 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -747,7 +747,7 @@ static int get_netmask(struct sockaddr_in *me, int *mask) { struct ifaddrs *ifaddrs, *i = NULL; - if (getifaddrs(&ifaddrs) < 0) { + if (!me || getifaddrs(&ifaddrs) < 0) { return -1; } @@ -755,7 +755,7 @@ static int get_netmask(struct sockaddr_in *me, int *mask) struct sockaddr_in *s = (struct sockaddr_in *)i->ifa_addr; struct sockaddr_in *m = (struct sockaddr_in *)i->ifa_netmask; - if (s->sin_addr.s_addr == me->sin_addr.s_addr) { + if (s && m && s->sin_addr.s_addr == me->sin_addr.s_addr) { *mask = m->sin_addr.s_addr; return 0; }