diff mbox series

ip: fix memory leak in do_show()

Message ID 20241125060848.56179-1-heminhong@kylinos.cn (mailing list archive)
State Accepted
Commit 0325d98f98baebd27cf7bd7f68b1e9eba4dc7d5b
Delegated to: Stephen Hemminger
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(+)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 25, 2024, 5:10 p.m. UTC | #1
Hello:

This patch was applied to iproute2/iproute2.git (main)
by Stephen Hemminger <stephen@networkplumber.org>:

On Mon, 25 Nov 2024 14:08:48 +0800 you wrote:
> Free the 'answer' obtained from 'rtnl_talk()'.
> 
> Signed-off-by: Minhong He <heminhong@kylinos.cn>
> ---
>  ip/ipnetconf.c | 1 +
>  1 file changed, 1 insertion(+)

Here is the summary with links:
  - ip: fix memory leak in do_show()
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=0325d98f98ba

You are awesome, thank you!
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: