s4-smbd: use tevent_re_initialise()
authorAndrew Tridgell <tridge@samba.org>
Fri, 26 Mar 2010 10:13:55 +0000 (21:13 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 26 Mar 2010 10:13:55 +0000 (21:13 +1100)
This fixes a crash bug on startup

source4/smbd/process_standard.c

index dfa4fa6b1c7a4b742bc99c27e0f2b934b3d157b5..032b999d4e7d898a2c77067d228c80c50ee4d475 100644 (file)
@@ -120,7 +120,9 @@ static void standard_accept_connection(struct tevent_context *ev,
        /* this will free all the listening sockets and all state that
           is not associated with this new connection */
        talloc_free(sock);
-       talloc_free(ev);
+       if (tevent_re_initialise(ev) != 0) {
+               smb_panic("Failed to re-initialise tevent after fork");
+       }
 
        /* we don't care if the dup fails, as its only a select()
           speed optimisation */
@@ -192,7 +194,9 @@ static void standard_new_task(struct tevent_context *ev,
 
        /* this will free all the listening sockets and all state that
           is not associated with this new connection */
-       talloc_free(ev);
+       if (tevent_re_initialise(ev) != 0) {
+               smb_panic("Failed to re-initialise tevent after fork");
+       }
 
        /* ldb/tdb need special fork handling */
        ldb_wrap_fork_hook();