s4: process_standard: Move talloc_free of event context so it is last thing freed...
authorJeremy Allison <jra@samba.org>
Fri, 7 Apr 2017 22:08:13 +0000 (15:08 -0700)
committerRalph Boehme <slow@samba.org>
Sat, 8 Apr 2017 10:30:08 +0000 (12:30 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source4/smbd/process_standard.c

index ca93f93ce55535e1631247e0fdd881a9abfc4d7d..f786d4dcc229c5430b3dae2c4696fd87f04843dc 100644 (file)
@@ -388,12 +388,13 @@ _NORETURN_ static void standard_terminate(struct tevent_context *ev, struct load
 {
        DEBUG(2,("standard_terminate: reason[%s]\n",reason));
 
-       talloc_free(ev);
-
        /* this reload_charcnv() has the effect of freeing the iconv context memory,
           which makes leak checking easier */
        reload_charcnv(lp_ctx);
 
+       /* Always free event context last before exit. */
+       talloc_free(ev);
+
        /* terminate this process */
        exit(0);
 }