diff --git a/source/client/client.c b/source/client/client.c index 202a007..9e11737 100644 --- a/source/client/client.c +++ b/source/client/client.c @@ -728,11 +728,11 @@ static void do_list_helper(const char *mntpoint, file_info *f, const char *mask, return; } p = strrchr_m(mask2,CLI_DIRSEP_CHAR); - if (!p) { - TALLOC_FREE(dir); - return; + if (p) { + p[1] = 0; + } else { + mask2[0] = '\0'; } - p[1] = 0; mask2 = talloc_asprintf_append(mask2, "%s%s*", f->name, diff --git a/source/libsmb/clidfs.c b/source/libsmb/clidfs.c index 35922b1..9fdc239 100644 --- a/source/libsmb/clidfs.c +++ b/source/libsmb/clidfs.c @@ -306,10 +306,11 @@ static void cli_cm_set_mntpoint(struct cli_state *c, const char *mnt) } if (p) { - char *name = clean_name(NULL, p->mount); + char *name = clean_name(NULL, mnt); if (!name) { return; } + TALLOC_FREE(p->mount); p->mount = talloc_strdup(p, name); TALLOC_FREE(name); }