};
static void free_dirsort_privates(void **datap) {
- struct dirsort_privates *data = (struct dirsort_privates *) *datap;
- SAFE_FREE(data->directory_list);
- SAFE_FREE(data);
- *datap = NULL;
+ TALLOC_FREE(*datap);
}
static bool open_and_sort_dir (vfs_handle_struct *handle)
SMB_VFS_NEXT_REWINDDIR(handle, data->source_directory);
/* Set up an array and read the directory entries into it */
- SAFE_FREE(data->directory_list); /* destroy previous cache if needed */
- data->directory_list = (struct dirent *)SMB_MALLOC(
- data->number_of_entries * sizeof(struct dirent));
+ TALLOC_FREE(data->directory_list); /* destroy previous cache if needed */
+ data->directory_list = talloc_zero_array(data,
+ struct dirent,
+ data->number_of_entries);
if (!data->directory_list) {
return false;
}
struct dirsort_privates *data = NULL;
/* set up our private data about this directory */
- data = (struct dirsort_privates *)SMB_MALLOC(
- sizeof(struct dirsort_privates));
-
+ data = talloc_zero(handle->conn, struct dirsort_privates);
if (!data) {
return NULL;
}
struct dirsort_privates *data = NULL;
/* set up our private data about this directory */
- data = (struct dirsort_privates *)SMB_MALLOC(
- sizeof(struct dirsort_privates));
-
+ data = talloc_zero(handle->conn, struct dirsort_privates);
if (!data) {
return NULL;
}
attr);
if (data->source_directory == NULL) {
- SAFE_FREE(data);
+ TALLOC_FREE(data);
return NULL;
}