From: Ralph Boehme Date: Wed, 18 Mar 2020 17:25:33 +0000 (+0100) Subject: smbd: update smb_Dir_destructor() to cope with fsp->dptr not being set X-Git-Tag: ldb-2.2.0~1234 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6bcc4bddc73e27ff3d36946f8bce927e41337c7;p=thirdparty%2Fsamba.git 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 --- 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; }