[PATCH] osmo-ggsn[master]: lib/tunc.c: tun_ipv6_linklocal_get(): fix memory leak with g...

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Oct 12 15:57:41 UTC 2017


Review at  https://gerrit.osmocom.org/4235

lib/tunc.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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/35/4235/1

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: newchange
Gerrit-Change-Id: If6300d1c8d36fcafef294a4c11bbda31a158bb9c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list