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);