diff options
author | Volker Lendecke <vl@samba.org> | 2009-11-16 09:49:23 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-11-18 23:16:13 +0100 |
commit | f6650f5d19ad90b8e1f392efbe211c4ffa0e70c0 (patch) | |
tree | 6091c37e17a96edaaab867094b99bfe8c5aa456d /source3/smbd/filename.c | |
parent | aea3a8f50131744f8393d0179cd04a1b97982028 (diff) | |
download | samba-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/smbd/filename.c')
-rw-r--r-- | source3/smbd/filename.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index a64ca27114..5d6661df2a 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -829,7 +829,8 @@ static int get_real_filename_full_scan(connection_struct *conn, TALLOC_CTX *mem_ctx, char **found_name) { struct smb_Dir *cur_dir; - char *dname = NULL; + const char *dname = NULL; + char *talloced = NULL; char *unmangled_name = NULL; long curpos; @@ -881,11 +882,11 @@ static int get_real_filename_full_scan(connection_struct *conn, /* now scan for matching names */ curpos = 0; - while ((dname = ReadDirName(cur_dir, &curpos, NULL))) { + while ((dname = ReadDirName(cur_dir, &curpos, NULL, &talloced))) { /* Is it dot or dot dot. */ if (ISDOT(dname) || ISDOTDOT(dname)) { - TALLOC_FREE(dname); + TALLOC_FREE(talloced); continue; } @@ -908,13 +909,13 @@ static int get_real_filename_full_scan(connection_struct *conn, TALLOC_FREE(cur_dir); if (!*found_name) { errno = ENOMEM; - TALLOC_FREE(dname); + TALLOC_FREE(talloced); return -1; } - TALLOC_FREE(dname); + TALLOC_FREE(talloced); return 0; } - TALLOC_FREE(dname); + TALLOC_FREE(talloced); } TALLOC_FREE(unmangled_name); |