[sr-dev] git:master:98a6ef19: core: free locl link structures not linked to listen sockets

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 4 09:01:13 CEST 2017


Module: kamailio
Branch: master
Commit: 98a6ef19bcfe14b7150183a9bec98854f5c0063b
URL: https://github.com/kamailio/kamailio/commit/98a6ef19bcfe14b7150183a9bec98854f5c0063b

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-07-04T09:00:45+02:00

core: free locl link structures not linked to listen sockets

---

Modified: src/core/socket_info.c

---

Diff:  https://github.com/kamailio/kamailio/commit/98a6ef19bcfe14b7150183a9bec98854f5c0063b.diff
Patch: https://github.com/kamailio/kamailio/commit/98a6ef19bcfe14b7150183a9bec98854f5c0063b.patch

---

diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 8344c950f2..1544ec4cbd 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -886,8 +886,8 @@ static int nl_bound_sock(void)
 	struct sockaddr_nl la;
 
 	sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
-	if(sock <= 0){
-		LM_ERR("could not create NETLINK sock to get interface list");
+	if(sock < 0){
+		LM_ERR("could not create NETLINK sock to get interface list\n");
 		goto error;
 	}
 
@@ -1077,7 +1077,7 @@ static int build_iface_list(void)
 			entry->next = 0;
 			entry->family = families[i];
 			entry->ifa_flags = ifi->ifa_flags;
-                        is_link_local = 0;
+            is_link_local = 0;
 
 			for(;RTA_OK(rtap, rtl);rtap=RTA_NEXT(rtap,rtl)){
 				switch(rtap->rta_type){
@@ -1110,7 +1110,10 @@ static int build_iface_list(void)
 						break;
 				}
 			}
-			if(is_link_local) continue;    /* link local addresses are not bindable */
+			if(is_link_local) {
+				pkg_free(entry);
+				continue;    /* link local addresses are not bindable */
+			}
 
 			if(strlen(ifaces[index].name)==0)
 				strncpy(ifaces[index].name, name, MAX_IF_LEN);




More information about the sr-dev mailing list