From 82656e80c94a3ce0bd758d2187afda61913a198c Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Thu, 31 Dec 2015 05:25:45 +0000 Subject: Re #1882 (misc): close socket on error after calling pj_sock_getsockname() as it was closed above on error after calling get_published_name() Thanks to Dusan Klinec for the patch git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5230 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip/sip_transport_udp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pjsip') diff --git a/pjsip/src/pjsip/sip_transport_udp.c b/pjsip/src/pjsip/sip_transport_udp.c index f11cafaf..9c87fb84 100644 --- a/pjsip/src/pjsip/sip_transport_udp.c +++ b/pjsip/src/pjsip/sip_transport_udp.c @@ -1090,8 +1090,10 @@ PJ_DEF(pj_status_t) pjsip_udp_transport_restart(pjsip_transport *transport, /* Init local address. */ status = pj_sock_getsockname(sock, &tp->base.local_addr, &tp->base.addr_len); - if (status != PJ_SUCCESS) - return status; + if (status != PJ_SUCCESS) { + pj_sock_close(sock); + return status; + } /* Assign the socket and published address to transport. */ udp_set_socket(tp, sock, a_name); -- cgit v1.2.3