summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--channels/chan_sip.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 3cc98d5e4..df80bc045 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3608,9 +3608,9 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_i
* is because we only have the IP address and the host field might be
* set as a name (and the reverse PTR might not match).
*/
- if (var) {
+ if (var && sin) {
for (tmp = var; tmp; tmp = tmp->next) {
- if (!strcasecmp(var->name, "host")) {
+ if (!strcasecmp(tmp->name, "host")) {
struct hostent *hp;
struct ast_hostent ahp;
if (!(hp = ast_gethostbyname(tmp->value, &ahp)) || (memcmp(&hp->h_addr, &sin->sin_addr, sizeof(hp->h_addr)))) {