diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-02-21 19:56:36 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-02-25 08:03:04 +0100 |
commit | 6f077d4017e6df9e070b1c3ea85b7afacf3437cd (patch) | |
tree | 68e25c7c02c490a32b47d2447f789107baa0f0ab | |
parent | f56ff422a525fc6fdf04de8e2ce5c5fa4c097629 (diff) | |
download | samba-6f077d4017e6df9e070b1c3ea85b7afacf3437cd.tar.gz samba-6f077d4017e6df9e070b1c3ea85b7afacf3437cd.tar.bz2 samba-6f077d4017e6df9e070b1c3ea85b7afacf3437cd.zip |
pvfs_open: unify talloc behavior in pvfs_can_delete/rename/stat()
And also handle NULL for lckp in the error path
without crashing.
metze
(This used to be commit 04eb1be0c67317067ee0ca70c731fef958cd513c)
-rw-r--r-- | source4/ntvfs/posix/pvfs_open.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c index 0d97b3d629..3a8b17ab16 100644 --- a/source4/ntvfs/posix/pvfs_open.c +++ b/source4/ntvfs/posix/pvfs_open.c @@ -1461,8 +1461,10 @@ NTSTATUS pvfs_can_delete(struct pvfs_state *pvfs, } } else if (!NT_STATUS_IS_OK(status)) { talloc_free(lck); - *lckp = lck; - } else if (lckp != NULL) { + if (lckp) { + *lckp = NULL; + } + } else if (lckp) { *lckp = lck; } @@ -1513,8 +1515,10 @@ NTSTATUS pvfs_can_rename(struct pvfs_state *pvfs, } } else if (!NT_STATUS_IS_OK(status)) { talloc_free(lck); - *lckp = lck; - } else if (lckp != NULL) { + if (lckp) { + *lckp = NULL; + } + } else if (lckp) { *lckp = lck; } @@ -1549,6 +1553,10 @@ NTSTATUS pvfs_can_stat(struct pvfs_state *pvfs, NTCREATEX_SHARE_ACCESS_WRITE, 0, 0); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(lck); + } + return status; } |