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>
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;
}