Change in osmo-hlr[master]: mdns_sock.c: fix resource leak of sock

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Mon Jan 13 14:57:40 UTC 2020


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-hlr/+/16845 )


Change subject: mdns_sock.c: fix resource leak of sock
......................................................................

mdns_sock.c: fix resource leak of sock

Fixes: CID#207542
Change-Id: I0216b17c3ff67910a39520e2f2a5a16e23575a86
---
M src/mslookup/mdns_sock.c
1 file changed, 3 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/45/16845/1

diff --git a/src/mslookup/mdns_sock.c b/src/mslookup/mdns_sock.c
index 5291660..1ca7d32 100644
--- a/src/mslookup/mdns_sock.c
+++ b/src/mslookup/mdns_sock.c
@@ -51,7 +51,7 @@
 					   void *data, unsigned int priv_nr)
 {
 	struct osmo_mdns_sock *ret;
-	int sock, rc;
+	int sock = -1, rc;
 	struct addrinfo hints = {0};
 	struct ip_mreq multicast_req = {0};
 	in_addr_t iface = INADDR_ANY;
@@ -117,6 +117,8 @@
 
 	return ret;
 error:
+	if (sock != -1)
+		close(sock);
 	if (ret->ai)
 		freeaddrinfo(ret->ai);
 	talloc_free(ret);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/16845
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I0216b17c3ff67910a39520e2f2a5a16e23575a86
Gerrit-Change-Number: 16845
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200113/cbb74f43/attachment.htm>


More information about the gerrit-log mailing list