s3: smbd: simplify dptr_CloseDir()
authorRalph Boehme <slow@samba.org>
Sun, 4 Aug 2019 07:15:47 +0000 (09:15 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 6 Aug 2019 14:23:36 +0000 (14:23 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/dir.c

index 61c9102936493954bea953b22e776868fd6338f0..5214ccc2dbf919078e3395e2a92186cad9a27ef6 100644 (file)
@@ -370,15 +370,17 @@ done:
 
 void dptr_CloseDir(files_struct *fsp)
 {
-       if (fsp->dptr) {
-               /*
-                * The destructor for the struct smb_Dir
-                * (fsp->dptr->dir_hnd) now handles
-                * all resource deallocation.
-                */
-               dptr_close_internal(fsp->dptr);
-               fsp->dptr = NULL;
+       if (fsp->dptr == NULL) {
+               return;
        }
+
+       /*
+        * The destructor for the struct smb_Dir (fsp->dptr->dir_hnd)
+        * now handles all resource deallocation.
+        */
+
+       dptr_close_internal(fsp->dptr);
+       fsp->dptr = NULL;
 }
 
 void dptr_SeekDir(struct dptr_struct *dptr, long offset)