netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iproute2: prevent memory leak on error return
@ 2023-11-14  8:13 heminhong
  2023-11-15 10:37 ` Petr Machata
  2023-11-29  4:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: heminhong @ 2023-11-14  8:13 UTC (permalink / raw)
  To: stephen, netdev; +Cc: heminhong

When rtnl_statsdump_req_filter() or rtnl_dump_filter() failed to process,
just return will cause memory leak.

Signed-off-by: heminhong <heminhong@kylinos.cn>
---
 ip/iplink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ip/iplink.c b/ip/iplink.c
index 9a548dd3..c7e5021c 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -1722,11 +1722,13 @@ static int iplink_afstats(int argc, char **argv)
 	if (rtnl_statsdump_req_filter(&rth, AF_UNSPEC, filt_mask,
 				      NULL, NULL) < 0) {
 		perror("Cannont send dump request");
+		delete_json_obj();
 		return 1;
 	}
 
 	if (rtnl_dump_filter(&rth, print_af_stats, &ctx) < 0) {
 		fprintf(stderr, "Dump terminated\n");
+		delete_json_obj();
 		return 1;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iproute2: prevent memory leak on error return
  2023-11-14  8:13 [PATCH] iproute2: prevent memory leak on error return heminhong
@ 2023-11-15 10:37 ` Petr Machata
  2023-11-29  4:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Petr Machata @ 2023-11-15 10:37 UTC (permalink / raw)
  To: heminhong; +Cc: stephen, netdev


heminhong <heminhong@kylinos.cn> writes:

> When rtnl_statsdump_req_filter() or rtnl_dump_filter() failed to process,
> just return will cause memory leak.
>
> Signed-off-by: heminhong <heminhong@kylinos.cn>

Reviewed-by: Petr Machata <petrm@nvidia.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iproute2: prevent memory leak on error return
  2023-11-14  8:13 [PATCH] iproute2: prevent memory leak on error return heminhong
  2023-11-15 10:37 ` Petr Machata
@ 2023-11-29  4:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-11-29  4:50 UTC (permalink / raw)
  To: heminhong; +Cc: stephen, netdev

Hello:

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

On Tue, 14 Nov 2023 16:13:07 +0800 you wrote:
> When rtnl_statsdump_req_filter() or rtnl_dump_filter() failed to process,
> just return will cause memory leak.
> 
> Signed-off-by: heminhong <heminhong@kylinos.cn>
> ---
>  ip/iplink.c | 2 ++
>  1 file changed, 2 insertions(+)

Here is the summary with links:
  - iproute2: prevent memory leak on error return
    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=389657c3ec43

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-29  4:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-14  8:13 [PATCH] iproute2: prevent memory leak on error return heminhong
2023-11-15 10:37 ` Petr Machata
2023-11-29  4:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).