diff mbox series

ip: fix memory leak in do_show()

Message ID 20241125060848.56179-1-heminhong@kylinos.cn (mailing list archive)
State New
Headers show
Series ip: fix memory leak in do_show() | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Minhong He Nov. 25, 2024, 6:08 a.m. UTC
Free the 'answer' obtained from 'rtnl_talk()'.

Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
 ip/ipnetconf.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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: