Change in libosmocore[master]: gprs_ns2_fr: fix resource leaks due to early return in set_ifupdown()

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Tue Jan 5 13:34:12 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21945 )


Change subject: gprs_ns2_fr: fix resource leaks due to early return in set_ifupdown()
......................................................................

gprs_ns2_fr: fix resource leaks due to early return in set_ifupdown()

Change-Id: Ie52bf8ac6d62e7f2d760294bf2fe90119cc96b4b
Related: CID#215869
---
M src/gb/gprs_ns2_fr.c
1 file changed, 6 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/21945/1

diff --git a/src/gb/gprs_ns2_fr.c b/src/gb/gprs_ns2_fr.c
index e972a34..ab12884 100644
--- a/src/gb/gprs_ns2_fr.c
+++ b/src/gb/gprs_ns2_fr.c
@@ -448,11 +448,15 @@
 	OSMO_STRLCPY_ARRAY(req.ifr_name, netif);
 
 	rc = ioctl(sock, SIOCGIFFLAGS, &req);
-	if (rc < 0)
+	if (rc < 0) {
+		close(sock);
 		return rc;
+	}
 
-	if ((req.ifr_flags & IFF_UP) == up)
+	if ((req.ifr_flags & IFF_UP) == up) {
+		close(sock);
 		return 0;
+	}
 
 	if (up)
 		req.ifr_flags |= IFF_UP;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie52bf8ac6d62e7f2d760294bf2fe90119cc96b4b
Gerrit-Change-Number: 21945
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210105/a805b4b8/attachment.htm>


More information about the gerrit-log mailing list