summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-03-06 15:34:37 +0100
committerStefan Metzmacher <metze@samba.org>2008-03-06 16:31:26 +0100
commit0339ae5ad82c248b43afa9431b13cda536b18fd6 (patch)
tree960646aa3c37c5f4328cda7c001dc7754e6e7b93 /source4/ntvfs/posix
parent87f2925252b910f2f403bdbb3f9158202cb7a2c5 (diff)
downloadsamba-0339ae5ad82c248b43afa9431b13cda536b18fd6.tar.gz
samba-0339ae5ad82c248b43afa9431b13cda536b18fd6.tar.bz2
samba-0339ae5ad82c248b43afa9431b13cda536b18fd6.zip
pvfs_open: fix crash/leak in case pvfs_setup_oplock() fails
metze (This used to be commit 5563238782e825f64a22b5f9e0a7deb687f50b19)
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r--source4/ntvfs/posix/pvfs_open.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index adf4c1ac18..792e35cd14 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -696,21 +696,20 @@ static NTSTATUS pvfs_create_file(struct pvfs_state *pvfs,
DLIST_ADD(pvfs->files.list, f);
+ /* setup a destructor to avoid file descriptor leaks on
+ abnormal termination */
+ talloc_set_destructor(f, pvfs_fnum_destructor);
+ talloc_set_destructor(f->handle, pvfs_handle_destructor);
+
if (pvfs->flags & PVFS_FLAG_FAKE_OPLOCKS) {
oplock_granted = OPLOCK_BATCH;
} else if (oplock_granted != OPLOCK_NONE) {
status = pvfs_setup_oplock(f, oplock_granted);
if (!NT_STATUS_IS_OK(status)) {
- talloc_free(lck);
return status;
}
}
- /* setup a destructor to avoid file descriptor leaks on
- abnormal termination */
- talloc_set_destructor(f, pvfs_fnum_destructor);
- talloc_set_destructor(f->handle, pvfs_handle_destructor);
-
io->generic.out.oplock_level = oplock_granted;
io->generic.out.file.ntvfs = f->ntvfs;
io->generic.out.create_action = NTCREATEX_ACTION_CREATED;