From 50ae7eafd27c9894b88d8d3c3650a569fd565ac9 Mon Sep 17 00:00:00 2001 From: Neels Janosch Hofmeyr Date: Fri, 3 Feb 2023 01:05:01 +0100 Subject: [PATCH] fix memleak on del_tunnel() failure Related: CID#307542 Change-Id: Ie29840a7518435447acf48f12e81fc520308a265 --- tools/gtp-tunnel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/gtp-tunnel.c b/tools/gtp-tunnel.c index 1d8486c..1868097 100644 --- a/tools/gtp-tunnel.c +++ b/tools/gtp-tunnel.c @@ -130,6 +130,7 @@ del_tunnel(int argc, char *argv[], int genl_id, struct mnl_socket *nl) gtp_ifidx = if_nametoindex(argv[2]); if (gtp_ifidx == 0) { fprintf(stderr, "wrong GTP interface %s\n", argv[2]); + gtp_tunnel_free(t); return EXIT_FAILURE; } gtp_tunnel_set_ifidx(t, gtp_ifidx); @@ -143,6 +144,7 @@ del_tunnel(int argc, char *argv[], int genl_id, struct mnl_socket *nl) } else { fprintf(stderr, "wrong GTP version %s, use v0 or v1\n", argv[3]); + gtp_tunnel_free(t); return EXIT_FAILURE; }