diff options
Diffstat (limited to 'source4/ntvfs/posix/pvfs_dirlist.c')
-rw-r--r-- | source4/ntvfs/posix/pvfs_dirlist.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/source4/ntvfs/posix/pvfs_dirlist.c b/source4/ntvfs/posix/pvfs_dirlist.c index 79d9a9a3fa..0482cda808 100644 --- a/source4/ntvfs/posix/pvfs_dirlist.c +++ b/source4/ntvfs/posix/pvfs_dirlist.c @@ -98,21 +98,19 @@ NTSTATUS pvfs_list(struct pvfs_state *pvfs, struct pvfs_filename *name, struct p while ((dent = readdir(odir))) { uint_t i = dir->count; const char *dname = dent->d_name; - char *short_name; - short_name = pvfs_short_name_component(pvfs, dname); - - /* check it matches the wildcard pattern */ if (ms_fnmatch(pattern, dname, - pvfs->tcon->smb_conn->negotiate.protocol) != 0 && - ms_fnmatch(pattern, short_name, pvfs->tcon->smb_conn->negotiate.protocol) != 0) { + char *short_name = pvfs_short_name_component(pvfs, dname); + if (short_name == NULL || + ms_fnmatch(pattern, short_name, + pvfs->tcon->smb_conn->negotiate.protocol) != 0) { + talloc_free(short_name); + continue; + } talloc_free(short_name); - continue; } - talloc_free(short_name); - if (dir->count >= allocated) { allocated = (allocated + 100) * 1.2; dir->names = talloc_realloc_p(dir, dir->names, const char *, allocated); |