summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-08-21 10:25:51 -0700
committerKarolin Seeger <kseeger@samba.org>2008-08-22 23:30:38 +0200
commit3c205320cd1eb19ed275572f975487e92c611f13 (patch)
treeb50a138c56dba9eb81606562f372d195ac8f0a31
parentef801d12a309c4c9f6429739b835fb32f5c309b8 (diff)
downloadsamba-3c205320cd1eb19ed275572f975487e92c611f13.tar.gz
Fix bug 5698 - mixup of TALLOC/malloc. Spotted by Douglas Wegscheid <Douglas_E_Wegscheid@whirlpool.com>.
Jeremy. (cherry picked from commit 02e260ab5254c9691846f7009f685e1b11032f80)
-rw-r--r--source/lib/util_str.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/lib/util_str.c b/source/lib/util_str.c
index c36d512239c..a2458c88b60 100644
--- a/source/lib/util_str.c
+++ b/source/lib/util_str.c
@@ -2006,6 +2006,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;
@@ -2028,7 +2029,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"));
@@ -2036,7 +2037,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;