Message ID | 20230515142116.33135-1-frank@lichtenheld.com |
---|---|
State | Accepted |
Headers | show |
Series | [Openvpn-devel] DCO: fix memory leak in dco_get_peer_stats_multi for Linux | expand |
Hi, On 15/05/2023 16:21, Frank Lichtenheld wrote: > Leaks a small amount of memory every 15s. > > Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> wonderful catch, Frank! Acked-by: Antonio Quartulli <a@unstable.cc> > --- > src/openvpn/dco_linux.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c > index 796e6f25..2bfdf980 100644 > --- a/src/openvpn/dco_linux.c > +++ b/src/openvpn/dco_linux.c > @@ -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
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 <frank@lichtenheld.com> Acked-by: Antonio Quartulli <a@unstable.cc> Message-Id: <20230515142116.33135-1-frank@lichtenheld.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26659.html Signed-off-by: Gert Doering <gert@greenie.muc.de> -- kind regards, Gert Doering
diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index 796e6f25..2bfdf980 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -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
Leaks a small amount of memory every 15s. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> --- src/openvpn/dco_linux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)