aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-11-08 16:08:20 +0900
committerHarald Welte <laforge@gnumonks.org>2017-11-14 00:08:51 +0900
commit318795635e513ab6c78fa2c4f83efe6e23942549 (patch)
tree8188bbb2efd1aa428779885ec0519b1e77f4d770
parent22e1573831571448b920d276ef62ebed355c7df9 (diff)
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
-rw-r--r--ggsn/gtp-kernel.c2
1 files changed, 2 insertions, 0 deletions
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 @@ static int gtp_kernel_init_once(void)
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);