r13571: Replace all calls to talloc_free() with thye TALLOC_FREE()
[kai/samba-autobuild/.git] / source / smbd / conn.c
index 6b5942f7f66709898258d1179dbc7178981b71f3..b41467f02c7514706903df5776b4ade436476550 100644 (file)
@@ -225,10 +225,10 @@ void conn_clear_vuid_cache(uint16 vuid)
 }
 
 /****************************************************************************
- Free a conn structure.
+ Free a conn structure - internal part.
 ****************************************************************************/
 
-void conn_free(connection_struct *conn)
+void conn_free_internal(connection_struct *conn)
 {
        vfs_handle_struct *handle = NULL, *thandle = NULL;
        TALLOC_CTX *mem_ctx = NULL;
@@ -243,43 +243,56 @@ void conn_free(connection_struct *conn)
                handle = thandle;
        }
 
-       DLIST_REMOVE(Connections, conn);
-
        if (conn->ngroups && conn->groups) {
                SAFE_FREE(conn->groups);
                conn->ngroups = 0;
        }
 
+       if (conn->nt_user_token) {
+               TALLOC_FREE(conn->nt_user_token);
+       }
+
        free_namearray(conn->veto_list);
        free_namearray(conn->hide_list);
        free_namearray(conn->veto_oplock_list);
+       free_namearray(conn->aio_write_behind_list);
        
        string_free(&conn->user);
        string_free(&conn->dirpath);
        string_free(&conn->connectpath);
        string_free(&conn->origpath);
 
-       bitmap_clear(bmap, conn->cnum);
-       num_open--;
-
        mem_ctx = conn->mem_ctx;
        ZERO_STRUCTP(conn);
        talloc_destroy(mem_ctx);
 }
 
+/****************************************************************************
+ Free a conn structure.
+****************************************************************************/
+
+void conn_free(connection_struct *conn)
+{
+       DLIST_REMOVE(Connections, conn);
+
+       bitmap_clear(bmap, conn->cnum);
+       num_open--;
 
+       conn_free_internal(conn);
+}
 /****************************************************************************
 receive a smbcontrol message to forcibly unmount a share
 the message contains just a share name and all instances of that
 share are unmounted
 the special sharename '*' forces unmount of all shares
 ****************************************************************************/
-void msg_force_tdis(int msg_type, pid_t pid, void *buf, size_t len)
+void msg_force_tdis(int msg_type, struct process_id pid, void *buf, size_t len)
 {
        connection_struct *conn, *next;
        fstring sharename;
 
-       fstrcpy(sharename, buf);
+       fstrcpy(sharename, (const char *)buf);
 
        if (strcmp(sharename, "*") == 0) {
                DEBUG(1,("Forcing close of all shares\n"));