1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

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>
This commit is contained in:
Noel Power 2019-05-22 09:29:18 +00:00 committed by Andreas Schneider
parent 0b6e37c9e8
commit 05d0806e71

View File

@ -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);