diff mbox series

[iproute2,v2] bridge: fix memory leak in error path

Message ID 20241126021819.18663-1-heminhong@kylinos.cn (mailing list archive)
State New
Delegated to: David Ahern
Headers show
Series [iproute2,v2] bridge: fix memory leak in error path | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Minhong He Nov. 26, 2024, 2:18 a.m. UTC
The 'json' object doesn't free when 'rtnl_dump_filter()' fails to process,
fix it.

Signed-off-by: Minhong He <heminhong@kylinos.cn>
---
 bridge/mst.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Nikolay Aleksandrov Nov. 26, 2024, 9:20 a.m. UTC | #1
On 26/11/2024 04:18, Minhong He wrote:
> The 'json' object doesn't free when 'rtnl_dump_filter()' fails to process,
> fix it.
> 
> Signed-off-by: Minhong He <heminhong@kylinos.cn>
> ---
>  bridge/mst.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/bridge/mst.c b/bridge/mst.c
> index 32f64aba..37362c45 100644
> --- a/bridge/mst.c
> +++ b/bridge/mst.c
> @@ -153,6 +153,7 @@ static int mst_show(int argc, char **argv)
>  
>  	if (rtnl_dump_filter(&rth, print_msts, stdout) < 0) {
>  		fprintf(stderr, "Dump terminated\n");
> +		delete_json_obj();
>  		return -1;
>  	}
>  

Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
diff mbox series

Patch

diff --git a/bridge/mst.c b/bridge/mst.c
index 32f64aba..37362c45 100644
--- a/bridge/mst.c
+++ b/bridge/mst.c
@@ -153,6 +153,7 @@  static int mst_show(int argc, char **argv)
 
 	if (rtnl_dump_filter(&rth, print_msts, stdout) < 0) {
 		fprintf(stderr, "Dump terminated\n");
+		delete_json_obj();
 		return -1;
 	}