[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241125060848.56179-1-heminhong@kylinos.cn>
Date: Mon, 25 Nov 2024 14:08:48 +0800
From: Minhong He <heminhong@...inos.cn>
To: stephen@...workplumber.org,
	netdev@...r.kernel.org
Cc: Minhong He <heminhong@...inos.cn>
Subject: [PATCH] ip: fix memory leak in do_show()
Free the 'answer' obtained from 'rtnl_talk()'.
Signed-off-by: Minhong He <heminhong@...inos.cn>
---
 ip/ipnetconf.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index cf27e7e3..020eff78 100644
--- a/ip/ipnetconf.c
+++ b/ip/ipnetconf.c
@@ -197,6 +197,7 @@ static int do_show(int argc, char **argv)
 			exit(2);
 
 		print_netconf2(answer, stdout);
+		free(answer);
 	} else {
 		rth.flags = RTNL_HANDLE_F_SUPPRESS_NLERR;
 dump:
-- 
2.25.1
Powered by blists - more mailing lists
 
