[MERGED] osmo-ggsn[master]: gtp-kernel: proper cleanup in error path

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Nov 13 15:23:28 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: gtp-kernel: proper cleanup in error path
......................................................................


gtp-kernel: proper cleanup in error path

When genl_socket_open() succeeds but genl_lookup_family() fails,
we have to clean up the socket that we just opened.

This requires a new version of libgtpnl :/

Change-Id: I31df046530347f88cb7b16c37a899b456ed1b080
---
M ggsn/gtp-kernel.c
1 file changed, 2 insertions(+), 0 deletions(-)

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



diff --git a/ggsn/gtp-kernel.c b/ggsn/gtp-kernel.c
index 8f538a2..a35153e 100644
--- a/ggsn/gtp-kernel.c
+++ b/ggsn/gtp-kernel.c
@@ -68,6 +68,8 @@
 	if (gtp_nl.genl_id < 0) {
 		SYS_ERR(DGGSN, LOGL_ERROR, 0,
 			"cannot lookup GTP genetlink ID\n");
+		genl_socket_close(gtp_nl.nl);
+		gtp_nl.nl = NULL;
 		return -1;
 	}
 	SYS_ERR(DGGSN, LOGL_DEBUG, 0, "Initialized GTP kernel mode (genl ID is %d)\n", gtp_nl.genl_id);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I31df046530347f88cb7b16c37a899b456ed1b080
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list