s3:smbd/globals: change 'int am_parent' into 'struct smbd_parent_context *am_parent'
[kai/samba.git] / source3 / smbd / server.c
index 7cd1b833263ee786671e0f7a1e740bd5a5592f7d..779bbba1fa0d46ca00fb658e5e23ab0eaf611cd5 100644 (file)
@@ -416,7 +416,14 @@ static void smbd_accept_connection(struct tevent_context *ev,
                NTSTATUS status = NT_STATUS_OK;
 
                /* Child code ... */
-               am_parent = 0;
+               am_parent = NULL;
+
+               /*
+                * Can't use TALLOC_FREE here. Nulling out the argument to it
+                * would overwrite memory we've just freed.
+                */
+               talloc_free(s->parent);
+               s = NULL;
 
                set_my_unique_id(unique_id);
 
@@ -430,13 +437,6 @@ static void smbd_accept_connection(struct tevent_context *ev,
                        close_low_fds(False); /* Don't close stderr */
                }
 
-               /*
-                * Can't use TALLOC_FREE here. Nulling out the argument to it
-                * would overwrite memory we've just freed.
-                */
-               talloc_free(s->parent);
-               s = NULL;
-
                status = reinit_after_fork(msg_ctx,
                                           ev,
                                           true);
@@ -1146,6 +1146,7 @@ extern void build_options(bool screen);
        parent->interactive = interactive;
        parent->ev_ctx = ev_ctx;
        parent->msg_ctx = msg_ctx;
+       am_parent = parent;
 
        se = tevent_add_signal(parent->ev_ctx,
                               parent,