summaryrefslogtreecommitdiff
path: root/source4/ntvfs/cifs
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2019-05-22 09:29:18 +0000
committerAndreas Schneider <asn@cryptomilk.org>2019-06-04 22:13:07 +0000
commit05d0806e71b6c3c31e4457c239bd2a5886187bf4 (patch)
treeb205d15618c0d13926be98a9a5b6746ac765d825 /source4/ntvfs/cifs
parent0b6e37c9e801435e094194dd60d9213b4868c3de (diff)
downloadsamba-05d0806e71b6c3c31e4457c239bd2a5886187bf4.tar.gz
s4/ntvfs/cifs: cppcheck: squash nullPointer: Possible null pointer dereference
Fix the following cppcheck warnings /home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:604: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck] /home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:605: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck] /home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:648: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck] /home/samba/samba-pidl/source4/ntvfs/cifs/vfs_cifs.c:649: warning: nullPointer: Possible null pointer dereference: file <--[cppcheck] Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source4/ntvfs/cifs')
-rw-r--r--source4/ntvfs/cifs/vfs_cifs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source4/ntvfs/cifs/vfs_cifs.c b/source4/ntvfs/cifs/vfs_cifs.c
index d88c034c6f2..4e11568ea46 100644
--- a/source4/ntvfs/cifs/vfs_cifs.c
+++ b/source4/ntvfs/cifs/vfs_cifs.c
@@ -598,9 +598,15 @@ static void async_open(struct smbcli_request *c_req)
struct cvfs_file *f = async->f;
union smb_open *io = async->parms;
union smb_handle *file;
+ if (f == NULL) {
+ goto failed;
+ }
talloc_free(async);
req->async_states->status = smb_raw_open_recv(c_req, req, io);
SMB_OPEN_OUT_FILE(io, file);
+ if (file == NULL) {
+ goto failed;
+ }
f->fnum = file->fnum;
file->ntvfs = NULL;
if (!NT_STATUS_IS_OK(req->async_states->status)) goto failed;
@@ -645,6 +651,9 @@ static NTSTATUS cvfs_open(struct ntvfs_module_context *ntvfs,
NT_STATUS_NOT_OK_RETURN(status);
SMB_OPEN_OUT_FILE(io, file);
+ if (file == NULL) {
+ return NT_STATUS_INVALID_PARAMETER;
+ }
f->fnum = file->fnum;
file->ntvfs = NULL;
status = ntvfs_handle_set_backend_data(f->h, p->ntvfs, f);