Fix smbd crash for close_on_completion
authorVolker Lendecke <vl@samba.org>
Sat, 28 Mar 2009 18:58:45 +0000 (19:58 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 22 Apr 2009 09:06:19 +0000 (11:06 +0200)
handle_trans() can talloc_free "conn" if the client requests
close_on_completion. "state" is a talloc_child of conn, so it will be gone when
we later free state->data et al.

source/smbd/ipc.c

index a53bc5bea2aea6ae9c0101063704476044f93eeb..8e40c30210eb7d475261a4baaeb2b2b9f00a2cf2 100644 (file)
@@ -658,6 +658,8 @@ void reply_trans(struct smb_request *req)
                return;
        }
 
+       talloc_steal(talloc_tos(), state);
+
        handle_trans(conn, req, state);
 
        SAFE_FREE(state->data);
@@ -787,6 +789,8 @@ void reply_transs(struct smb_request *req)
          */
         SCVAL(req->inbuf,smb_com,SMBtrans);
 
+       talloc_steal(talloc_tos(), state);
+
        handle_trans(conn, req, state);
 
        DLIST_REMOVE(conn->pending_trans, state);