nat_traversal: handle return values for errors
authorDaniel-Constantin Mierla <miconda@gmail.com>
Sat, 22 Jul 2017 06:34:01 +0000 (08:34 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Sat, 22 Jul 2017 06:34:01 +0000 (08:34 +0200)
src/modules/nat_traversal/nat_traversal.c

index 8bd4add..d3c6c95 100644 (file)
@@ -1573,6 +1573,10 @@ send_keepalive(NAT_Contact *contact)
     lport = 0;
     lproto = PROTO_NONE;
     hostent = sip_resolvehost(&nat_ip, &lport, &lproto);
+    if(hostent==NULL) {
+        LM_ERR("sip resolve host failed\n");
+        return;
+    }
     hostent2su(&dst.to, hostent, 0, nat_port);
        dst.proto=PROTO_UDP;
        dst.send_sock=contact->socket;
@@ -1900,7 +1904,9 @@ reply_filter(struct sip_msg *reply)
     static str prefix = {NULL, 0};
     str call_id;
 
-    parse_headers(reply, HDR_VIA2_F, 0);
+    if(parse_headers(reply, HDR_VIA2_F, 0)<0) {
+        LM_DBG("second via not parsed\n");
+    }
     if (reply->via2)
         return 1;