From d89e14d92623731d2fa6343a11072caab32e13cd Mon Sep 17 00:00:00 2001 From: Guido Vranken Date: Fri, 9 Jun 2017 00:04:36 +0200 Subject: [PATCH] Fix memory leak in add_option() for option 'connection' This patch ensures that if an error occurs while processing the 'connection' directive of an options specification, the variable 'struct options sub', which is initialized with init_options(), is properly freed with uninit_options(). Signed-off-by: Guido Vranken Acked-by: Gert Doering Message-Id: URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg14764.html Signed-off-by: Gert Doering --- src/openvpn/options.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 452087ade..f66bd2fda 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -5302,12 +5302,14 @@ add_option(struct options *options, if (!sub.ce.remote) { msg(msglevel, "Each 'connection' block must contain exactly one 'remote' directive"); + uninit_options(&sub); goto err; } e = alloc_connection_entry(options, msglevel); if (!e) { + uninit_options(&sub); goto err; } *e = sub.ce; -- 2.47.2