summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/modules/vfs_dirsort.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/source3/modules/vfs_dirsort.c b/source3/modules/vfs_dirsort.c
index d6f19b52ec..e2c61dab17 100644
--- a/source3/modules/vfs_dirsort.c
+++ b/source3/modules/vfs_dirsort.c
@@ -114,6 +114,11 @@ static 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)) {