From b6bcc4bddc73e27ff3d36946f8bce927e41337c7 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 18 Mar 2020 18:25:33 +0100 Subject: [PATCH] smbd: update smb_Dir_destructor() to cope with fsp->dptr not being set Currently the only caller of OpenDir_fsp() is dptr_create() which means fsp->dptr will always be set by dptr_create(). A subsequent commit will add another caller so that fsp->dptr will end up being NULL. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/smbd/dir.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 5faf139c097..94e9061d531 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1317,8 +1317,10 @@ static int smb_Dir_destructor(struct smb_Dir *dir_hnd) SMB_VFS_CLOSEDIR(dir_hnd->conn, dir_hnd->dir); fsp->fh->fd = -1; - SMB_ASSERT(fsp->dptr->dir_hnd == dir_hnd); - fsp->dptr->dir_hnd = NULL; + if (fsp->dptr != NULL) { + SMB_ASSERT(fsp->dptr->dir_hnd == dir_hnd); + fsp->dptr->dir_hnd = NULL; + } dir_hnd->fsp = NULL; return 0; }