summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-08-21 10:25:02 -0700
committerJeremy Allison <jra@samba.org>2008-08-21 10:25:02 -0700
commit9efccda1cce9be45ed856c978ddb73c3296cd2bb (patch)
treee604d03d92d1c288959249e5e4230799a2c0e135 /source3/lib/util_str.c
parentf2564f1dcc553b3bdf062355899362ce13951c6a (diff)
downloadsamba-9efccda1cce9be45ed856c978ddb73c3296cd2bb.tar.gz
samba-9efccda1cce9be45ed856c978ddb73c3296cd2bb.tar.bz2
samba-9efccda1cce9be45ed856c978ddb73c3296cd2bb.zip
Fix bug 5698 - mixup of TALLOC/malloc. Spotted by Douglas Wegscheid <Douglas_E_Wegscheid@whirlpool.com>.
Jeremy. (This used to be commit 1295bb9787dde69b4be4acee7b66eb782afe9c42)
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r--source3/lib/util_str.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 5f26cc80f8..9f952abf10 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -2008,6 +2008,7 @@ bool str_list_sub_basic( char **list, const char *smb_name,
bool str_list_substitute(char **list, const char *pattern, const char *insert)
{
+ TALLOC_CTX *ctx = list;
char *p, *s, *t;
ssize_t ls, lp, li, ld, i, d;
@@ -2030,7 +2031,7 @@ bool str_list_substitute(char **list, const char *pattern, const char *insert)
t = *list;
d = p -t;
if (ld) {
- t = (char *) SMB_MALLOC(ls +ld +1);
+ t = TALLOC_ARRAY(ctx, char, ls +ld +1);
if (!t) {
DEBUG(0,("str_list_substitute: "
"Unable to allocate memory"));
@@ -2038,7 +2039,7 @@ bool str_list_substitute(char **list, const char *pattern, const char *insert)
}
memcpy(t, *list, d);
memcpy(t +d +li, p +lp, ls -d -lp +1);
- SAFE_FREE(*list);
+ TALLOC_FREE(*list);
*list = t;
ls += ld;
s = t +d +li;