From: Guido Vranken Date: Thu, 8 Jun 2017 22:04:36 +0000 (+0200) Subject: Fix memory leak in add_option() for option 'connection' X-Git-Tag: v2.4.3~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42fc73b969f4e34fd985a0be59d162fb2ee498e1;p=thirdparty%2Fopenvpn.git 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 (cherry picked from commit d89e14d92623731d2fa6343a11072caab32e13cd) --- diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 57818e132..41129ca09 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -5318,12 +5318,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;