]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fix memory leak after sighup
authorSteffan Karger <steffan.karger@fox-it.com>
Wed, 29 Aug 2018 13:49:43 +0000 (15:49 +0200)
committerGert Doering <gert@greenie.muc.de>
Mon, 3 Sep 2018 08:29:54 +0000 (10:29 +0200)
The c.es env_set is (re)allocated for each "sighup loop iteration", while
it was free'd only once at process shutdown.  Move the env_set_destroy()
call to match the same level as the env_set_create() call to fix that.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1535550583-21825-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg17429.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7170bef507bfe74ceb4a12f8f10df4d2d6ad39c9)

src/openvpn/openvpn.c

index b9e914a84d2c017e557bf7c8a6e7877111179056..381988958024a1b9e2973eaab8c60abeafbc1dc9 100644 (file)
@@ -329,6 +329,7 @@ openvpn_main(int argc, char *argv[])
             }
             while (c.sig->signal_received == SIGUSR1);
 
+            env_set_destroy(c.es);
             uninit_options(&c.options);
             gc_reset(&c.gc);
         }
@@ -337,8 +338,6 @@ openvpn_main(int argc, char *argv[])
 
     context_gc_free(&c);
 
-    env_set_destroy(c.es);
-
 #ifdef ENABLE_MANAGEMENT
     /* close management interface */
     close_management();