[MERGED] osmo-ggsn[master]: lib/tun.c: tun_ipv6_linklocal_get(): fix memory leak with ge...

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Oct 13 14:12:59 UTC 2017


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: lib/tun.c: tun_ipv6_linklocal_get(): fix memory leak with getifaddrs()
......................................................................


lib/tun.c: tun_ipv6_linklocal_get(): fix memory leak with getifaddrs()

>From getifaddrs(3) man:
"The data returned by getifaddrs() is dynamically allocated and should
be freed using freeifaddrs() when no longer needed"

Change-Id: If6300d1c8d36fcafef294a4c11bbda31a158bb9c
---
M lib/tun.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/lib/tun.c b/lib/tun.c
index 32a8d2d..35d371e 100644
--- a/lib/tun.c
+++ b/lib/tun.c
@@ -776,7 +776,9 @@
 			continue;
 
 		*ia = sin6->sin6_addr;
+		freeifaddrs(ifaddr);
 		return 0;
 	}
+	freeifaddrs(ifaddr);
 	return -1;
 }

-- 
To view, visit https://gerrit.osmocom.org/4235
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If6300d1c8d36fcafef294a4c11bbda31a158bb9c
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>


More information about the gerrit-log mailing list