Check SMB_VFS_NEXT_OPENDIR return in dirsort_opendir().
authorJeremy Allison <jra@samba.org>
Tue, 9 Apr 2013 17:38:24 +0000 (10:38 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 12 Aug 2013 07:09:43 +0000 (09:09 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 052f74c2122301a3be19ab84ee4551f3259a3ee5)

source3/modules/vfs_dirsort.c

index 82b96eb3ecadf867d2e70875dd050ace77ba15c7..25a8cac81522f3fe053771c079378db187012abb 100644 (file)
@@ -114,6 +114,11 @@ static SMB_STRUCT_DIR *dirsort_opendir(vfs_handle_struct *handle,
        data->source_directory = SMB_VFS_NEXT_OPENDIR(handle, fname, mask,
                                                      attr);
 
+       if (data->source_directory == NULL) {
+               TALLOC_FREE(data);
+               return NULL;
+       }
+
        data->fd = dirfd(data->source_directory);
 
        if (!open_and_sort_dir(handle, data)) {