summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_str.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 7cd0f78439..01e81e48c3 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -2053,7 +2053,8 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx,
const char *str;
char *s;
int num, lsize;
- pstring tok;
+ char *tok;
+ TALLOC_CTX *frame = NULL;
if (!string || !*string)
return NULL;
@@ -2072,7 +2073,8 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx,
list = NULL;
str = s;
- while (next_token(&str, tok, sep, sizeof(tok))) {
+ frame = talloc_stackframe();
+ while (next_token_talloc(frame, &str, &tok, sep)) {
if (num == lsize) {
lsize += S_LIST_ABS;
if (mem_ctx) {
@@ -2094,6 +2096,7 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx,
} else {
SAFE_FREE(s);
}
+ TALLOC_FREE(frame);
return NULL;
} else {
list = rlist;
@@ -2116,12 +2119,15 @@ static char **str_list_make_internal(TALLOC_CTX *mem_ctx,
} else {
SAFE_FREE(s);
}
+ TALLOC_FREE(frame);
return NULL;
}
num++;
}
+ TALLOC_FREE(frame);
+
if (mem_ctx) {
TALLOC_FREE(s);
} else {