diff --git a/pjlib/src/pj/ip_helper_generic.c b/pjlib/src/pj/ip_helper_generic.c index 478c6b12f..f40aafc85 100644 --- a/pjlib/src/pj/ip_helper_generic.c +++ b/pjlib/src/pj/ip_helper_generic.c @@ -514,12 +514,12 @@ static pj_status_t get_ipv6_deprecated(unsigned *count, pj_sockaddr addr[]) if (nlmsg_len < sizeof (struct nlmsghdr)) return PJ_ETOOSMALL; - if (nlmsg_ptr->nlmsg_type == NLMSG_DONE) - break; - for(; NLMSG_OK(nlmsg_ptr, nlmsg_len); nlmsg_ptr = NLMSG_NEXT(nlmsg_ptr, nlmsg_len)) { + if (nlmsg_ptr->nlmsg_type == NLMSG_DONE) + goto nlmsg_done; + struct ifaddrmsg *ifaddrmsg_ptr; struct rtattr *rtattr_ptr; int ifaddrmsg_len; @@ -558,6 +558,7 @@ static pj_status_t get_ipv6_deprecated(unsigned *count, pj_sockaddr addr[]) } } } + nlmsg_done:; close(fd); *count = idx; diff --git a/pjnath/src/pjnath/ice_session.c b/pjnath/src/pjnath/ice_session.c index f1448ff88..774a6cce9 100644 --- a/pjnath/src/pjnath/ice_session.c +++ b/pjnath/src/pjnath/ice_session.c @@ -838,12 +838,12 @@ static PJ_DEF(void) get_invalid_addresses(char** addresses, size_t* size) return; } - if (nlmsg_ptr->nlmsg_type == NLMSG_DONE) - break; - for(; NLMSG_OK(nlmsg_ptr, nlmsg_len); nlmsg_ptr = NLMSG_NEXT(nlmsg_ptr, nlmsg_len)) { + if (nlmsg_ptr->nlmsg_type == NLMSG_DONE) + goto nlmsg_done; + struct ifaddrmsg *ifaddrmsg_ptr; struct rtattr *rtattr_ptr; int ifaddrmsg_len; @@ -886,6 +886,7 @@ static PJ_DEF(void) get_invalid_addresses(char** addresses, size_t* size) } } } + nlmsg_done:; close(fd); *size = idx;