r3635: fixed the crash from the BASE-DISCONNECT test
authorAndrew Tridgell <tridge@samba.org>
Tue, 9 Nov 2004 10:50:13 +0000 (10:50 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:41 +0000 (13:05 -0500)
source/ntvfs/posix/pvfs_lock.c

index a2691cb550298ef81910242c043564d55075d4a5..485199e6f8b3e7721de136433d933bb638071772 100644 (file)
@@ -188,6 +188,7 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas
                                if (pending->wait_handle == NULL) {
                                        pvfs_lock_async_failed(pvfs, req, f, locks, i, NT_STATUS_NO_MEMORY);
                                } else {
+                                       talloc_steal(pending, pending->wait_handle);
                                        DLIST_ADD(f->pending_list, pending);
                                }
                                return;
@@ -224,7 +225,6 @@ void pvfs_lock_close(struct pvfs_state *pvfs, struct pvfs_file *f)
        for (p=f->pending_list;p;p=next) {
                next = p->next;
                DLIST_REMOVE(f->pending_list, p);
-               talloc_free(p->wait_handle);
                p->req->async_states->status = NT_STATUS_RANGE_NOT_LOCKED;
                p->req->async_states->send_fn(p->req);
        }
@@ -374,6 +374,7 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs,
                                if (pending->wait_handle == NULL) {
                                        return NT_STATUS_NO_MEMORY;
                                }
+                               talloc_steal(pending, pending->wait_handle);
                                DLIST_ADD(f->pending_list, pending);
                                return NT_STATUS_OK;
                        }