Message ID | 20230512155023.444406-1-frank@lichtenheld.com |
---|---|
State | Accepted |
Headers | show |
Series | [Openvpn-devel] dco_linux: properly close dco version file | expand |
Acked-by: Gert Doering <gert@greenie.muc.de> "Obviously correct in hindsight"... (there is other weirdness in this function, like, "why use a struct buffer if all you want is a gc-allocated char[256]?", but that's for a different day to fix). Have stared-at-code and test compiled on Linux. Your patch has been applied to the master and release/2.6 branch. commit cf496476b364f8613bacd48e10d6a1bbbf0aceda (master) commit 26ea58f94ce10e108aa7c607b0a7dcb3419449fc (release/2.6) Author: Frank Lichtenheld Date: Fri May 12 17:50:23 2023 +0200 dco_linux: properly close dco version file Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20230512155023.444406-1-frank@lichtenheld.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26650.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 41540c0f..796e6f25 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -1020,6 +1020,7 @@ dco_version_string(struct gc_arena *gc) if (!fgets(BSTR(&out), BCAP(&out), fp)) { + fclose(fp); return "ERR"; } @@ -1031,6 +1032,7 @@ dco_version_string(struct gc_arena *gc) *nl = '\0'; } + fclose(fp); return BSTR(&out); }
Since we only call this once, it is not a bad leak, but still. Change-Id: Id85766738c3ece4f2d1860f7d101e4446a894aed Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> --- src/openvpn/dco_linux.c | 2 ++ 1 file changed, 2 insertions(+)