summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_streams_depot.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-11-16 09:49:23 +0100
committerVolker Lendecke <vl@samba.org>2009-11-18 23:16:13 +0100
commitf6650f5d19ad90b8e1f392efbe211c4ffa0e70c0 (patch)
tree6091c37e17a96edaaab867094b99bfe8c5aa456d /source3/modules/vfs_streams_depot.c
parentaea3a8f50131744f8393d0179cd04a1b97982028 (diff)
downloadsamba-f6650f5d19ad90b8e1f392efbe211c4ffa0e70c0.tar.gz
samba-f6650f5d19ad90b8e1f392efbe211c4ffa0e70c0.tar.bz2
samba-f6650f5d19ad90b8e1f392efbe211c4ffa0e70c0.zip
s3: Do not talloc in readdir
This is a hot codepath (called from the stat cache)
Diffstat (limited to 'source3/modules/vfs_streams_depot.c')
-rw-r--r--source3/modules/vfs_streams_depot.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index d7b878b882..853d7b4d98 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -382,7 +382,8 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
{
char *dirname;
SMB_STRUCT_DIR *dirhandle = NULL;
- char *dirent = NULL;
+ const char *dirent = NULL;
+ char *talloced = NULL;
dirname = stream_dir(handle, smb_fname_base, &smb_fname_base->st,
false);
@@ -406,20 +407,21 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
return map_nt_error_from_unix(errno);
}
- while ((dirent = vfs_readdirname(handle->conn, dirhandle, NULL)) != NULL) {
+ while ((dirent = vfs_readdirname(handle->conn, dirhandle, NULL,
+ &talloced)) != NULL) {
if (ISDOT(dirent) || ISDOTDOT(dirent)) {
- TALLOC_FREE(dirent);
+ TALLOC_FREE(talloced);
continue;
}
DEBUG(10, ("walk_streams: dirent=%s\n", dirent));
if (!fn(dirname, dirent, private_data)) {
- TALLOC_FREE(dirent);
+ TALLOC_FREE(talloced);
break;
}
- TALLOC_FREE(dirent);
+ TALLOC_FREE(talloced);
}
SMB_VFS_NEXT_CLOSEDIR(handle, dirhandle);