iproute2/lib
Denys Fedoryshchenko 6d25be27cc libnetlink.c: Fix memory leak in batch mode
During testing we noticed significant memory leak that is easily
reproducible and detectable with valgrind:

==2006284== 393,216 bytes in 12 blocks are definitely lost in loss record 5 of 5
==2006284==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2006284==    by 0x18C73E: rtnl_recvmsg (libnetlink.c:830)
==2006284==    by 0x18CF9E: __rtnl_talk_iov (libnetlink.c:1032)
==2006284==    by 0x18D3CE: __rtnl_talk (libnetlink.c:1140)
==2006284==    by 0x18D4DE: rtnl_talk (libnetlink.c:1168)
==2006284==    by 0x11BF04: tc_filter_modify (tc_filter.c:224)
==2006284==    by 0x11DD70: do_filter (tc_filter.c:748)
==2006284==    by 0x116B06: do_cmd (tc.c:210)
==2006284==    by 0x116C7C: tc_batch_cmd (tc.c:231)
==2006284==    by 0x1796F2: do_batch (utils.c:1701)
==2006284==    by 0x116D05: batch (tc.c:246)
==2006284==    by 0x117327: main (tc.c:331)
==2006284==
==2006284== LEAK SUMMARY:
==2006284==    definitely lost: 884,736 bytes in 27 blocks

In case nlmsg_type == NLMSG_ERROR and if answer set to NULL, we
should free(buf) too.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2023-02-17 17:37:48 -08:00
..
ax25_ntop.c lib: fix ax25.h include for musl 2022-01-15 10:41:13 -08:00
bpf_glue.c bpf_glue: include errno.h 2022-07-25 12:07:16 -07:00
bpf_legacy.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
bpf_libbpf.c libbpf: add xdp program name support 2022-07-08 09:09:13 -06:00
cg_map.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
color.c lib/color: make local functions static 2018-11-19 11:42:44 -08:00
coverity_model.c scrub out whitespace issues 2016-03-27 10:50:14 -07:00
exec.c netns: switch netns in the child when executing commands 2019-06-20 14:30:41 -07:00
fs.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
inet_proto.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
json_print_math.c build: Fix link errors on some systems 2021-01-18 12:28:47 -08:00
json_print.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
json_writer.c json: do not escape single quotes 2022-11-03 11:30:20 -07:00
libgenl.c libgenl: make genl_add_mcast_grp set errno on error 2021-05-17 11:59:37 -07:00
libnetlink.c libnetlink.c: Fix memory leak in batch mode 2023-02-17 17:37:48 -08:00
ll_addr.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
ll_map.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
ll_proto.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
ll_types.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
Makefile lib: Introduce ppp protocols 2022-07-29 11:22:42 -06:00
mnl_utils.c libnetlink: add offset for nl_dump_ext_ack_done 2022-09-27 21:18:49 -06:00
mpls_ntop.c SPDX license identifiers 2017-11-24 12:21:35 -08:00
mpls_pton.c SPDX license identifiers 2017-11-24 12:21:35 -08:00
names.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
namespace.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
netrom_ntop.c NETROM: Add netrom_ntop implementation. 2021-09-23 20:02:37 -06:00
ppp_proto.c lib: Introduce ppp protocols 2022-07-29 11:22:42 -06:00
rose_ntop.c ROSE: Add rose_ntop implementation. 2021-09-23 20:02:45 -06:00
rt_names.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00
utils_math.c build: Fix link errors on some systems 2021-01-18 12:28:47 -08:00
utils.c lib: replace GPL boilerplate with SPDX 2023-01-14 09:00:34 -08:00