DCO: fix memory leak in dco_get_peer_stats_multi for Linux
PATCH 1/1 DCO: fix memory leak in dco_get_peer_stats_multi for Linux
Leaks a small amount of memory every 15s.
Signed-off-by Frank Lichtenheld <[email protected]...>
--- src/openvpn/dco_linux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
src/openvpn/dco_linux.c +4 -1
@@ -925,7 +925,10 @@ dco_get_peer_stats_multi(dco_context_t *dco, struct multi_context *m)nlmsg_hdr (nl_msg)->nlmsg_flags |=NLM_F_DUMP ; -return ovpn_nl_msg_send (dco, nl_msg, dco_parse_peer_multi, m, __func__); +int ret =ovpn_nl_msg_send (dco, nl_msg, dco_parse_peer_multi, m, __func__); + +nlmsg_free (nl_msg); +return ret; } static int
Signature · 1 line
2.34.1
Hi,
Quoted 3 lines · Frank Lichtenheld
Leaks a small amount of memory every 15s.
Signed-off-by Frank Lichtenheld <[email protected]...>
wonderful catch, Frank!
Quoted 20 lines
--- src/openvpn/dco_linux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)src/openvpn/dco_linux.c +4
-1@@ -925,7 +925,10 @@ dco_get_peer_stats_multi(dco_context_t *dco, struct multi_context *m)nlmsg_hdr (nl_msg)->nlmsg_flags |=NLM_F_DUMP ; -return ovpn_nl_msg_send (dco, nl_msg, dco_parse_peer_multi, m, __func__); +int ret =ovpn_nl_msg_send (dco, nl_msg, dco_parse_peer_multi, m, __func__); + +nlmsg_free (nl_msg); +return ret; } static int
Signature · 1 line
Antonio Quartulli
Good catch!
I have done a basic "does it still compile and not crash?" test on the server-with-DCO test rig. Does not crash :-) - and the patch looks good.
Your patch has been applied to the master and release/2.6 branch.
commit 276f7c86d70666bc2ab4e6192ef5f1dcbd6a230f (master) commit 5e8a571af165c867ccb9c4c9e6334620f42013ac (release/2.6)
Author: Frank Lichtenheld Date: Mon May 15 16:21:16 2023 +0200
DCO: fix memory leak in dco_get_peer_stats_multi for Linux
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Antonio Quartulli <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg26659.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering