Browse code

Fix memory leak after sighup

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>

Steffan Karger authored on 2018/08/29 22:49:43
Showing 1 changed files
... ...
@@ -329,6 +329,7 @@ openvpn_main(int argc, char *argv[])
329 329
             }
330 330
             while (c.sig->signal_received == SIGUSR1);
331 331
 
332
+            env_set_destroy(c.es);
332 333
             uninit_options(&c.options);
333 334
             gc_reset(&c.gc);
334 335
         }
... ...
@@ -337,8 +338,6 @@ openvpn_main(int argc, char *argv[])
337 337
 
338 338
     context_gc_free(&c);
339 339
 
340
-    env_set_destroy(c.es);
341
-
342 340
 #ifdef ENABLE_MANAGEMENT
343 341
     /* close management interface */
344 342
     close_management();