diff options
author | heminhong <heminhong@kylinos.cn> | 2023-11-14 16:13:07 +0800 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2023-11-28 20:47:02 -0800 |
commit | 389657c3ec43227a238a832b4494095cc5c91a32 (patch) | |
tree | 3e406dc92f904eb5e510b9a19e29bd850abcfd68 | |
parent | f7a587583263843cb6314eaebf65049163fae0ed (diff) | |
download | iproute2-389657c3ec43227a238a832b4494095cc5c91a32.tar.gz |
iproute2: prevent memory leak on error return
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>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r-- | ip/iplink.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ip/iplink.c b/ip/iplink.c index 9a548dd35..c7e5021c5 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; } |