mirror of
https://github.com/samba-team/samba.git
synced 2025-03-01 04:58:35 +03:00
lib/util: Avoid a talloc in ms_fnmatch_protocol
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
This commit is contained in:
parent
b4ed72a2d3
commit
a551d3826d
@ -165,7 +165,6 @@ int ms_fnmatch_protocol(const char *pattern, const char *string, int protocol,
|
||||
bool is_case_sensitive)
|
||||
{
|
||||
int ret, count, i;
|
||||
struct max_n *max_n = NULL;
|
||||
|
||||
if (strcmp(string, "..") == 0) {
|
||||
string = ".";
|
||||
@ -210,16 +209,15 @@ int ms_fnmatch_protocol(const char *pattern, const char *string, int protocol,
|
||||
if (pattern[i] == '*' || pattern[i] == '<') count++;
|
||||
}
|
||||
|
||||
max_n = talloc_zero_array(NULL, struct max_n, count);
|
||||
if (max_n == NULL) {
|
||||
return -1;
|
||||
{
|
||||
struct max_n max_n[count];
|
||||
|
||||
memset(max_n, 0, sizeof(struct max_n) * count);
|
||||
|
||||
ret = ms_fnmatch_core(pattern, string, max_n, strrchr(string, '.'),
|
||||
is_case_sensitive);
|
||||
}
|
||||
|
||||
ret = ms_fnmatch_core(pattern, string, max_n, strrchr(string, '.'),
|
||||
is_case_sensitive);
|
||||
|
||||
talloc_free(max_n);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user