summaryrefslogtreecommitdiff
path: root/source4/torture/basic
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-09-22 22:06:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:03 -0500
commit8ab562dcb2996c3b1c1efbc7e7653dd5bc3a4823 (patch)
treec5c5a9272b3b41f1e3359886d1383f632dd308d3 /source4/torture/basic
parent5e7259a6977078b95008856a3f8986fbb99e7a1b (diff)
downloadsamba-8ab562dcb2996c3b1c1efbc7e7653dd5bc3a4823.tar.gz
samba-8ab562dcb2996c3b1c1efbc7e7653dd5bc3a4823.tar.bz2
samba-8ab562dcb2996c3b1c1efbc7e7653dd5bc3a4823.zip
r2536: This is a classic case for the use of our new talloc code, and
convert_string_talloc(). Andrew Bartlett (This used to be commit 79776006b37fa9df0586711edaba5335467461ac)
Diffstat (limited to 'source4/torture/basic')
-rw-r--r--source4/torture/basic/charset.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c
index 879f20617f..cb29645de6 100644
--- a/source4/torture/basic/charset.c
+++ b/source4/torture/basic/charset.c
@@ -40,8 +40,9 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree,
int i;
NTSTATUS status;
- ucs_name = malloc((1+u_name_len)*2);
+ ucs_name = talloc(NULL, (1+u_name_len)*2);
if (!ucs_name) {
+ printf("Failed to create UCS2 Name - talloc() failure\n");
return NT_STATUS_NO_MEMORY;
}
@@ -50,16 +51,16 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree,
}
SSVAL(ucs_name, i*2, 0);
- i = convert_string_allocate(CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname);
+ i = convert_string_talloc(ucs_name, CH_UTF16, CH_UNIX, ucs_name, (1+u_name_len)*2, (void **)&fname);
if (i == -1) {
- free(ucs_name);
+ printf("Failed to convert UCS2 Name into unix - convert_string_talloc() failure\n");
+ talloc_free(ucs_name);
return NT_STATUS_NO_MEMORY;
}
- asprintf(&fname2, "%s%s", BASEDIR, fname);
+ fname2 = talloc_asprintf(ucs_name, "%s%s", BASEDIR, fname);
if (!fname2) {
- free(fname);
- free(ucs_name);
+ talloc_free(ucs_name);
return NT_STATUS_NO_MEMORY;
}
@@ -79,9 +80,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree,
status = smb_raw_open(tree, mem_ctx, &io);
- free(fname);
- free(fname2);
- free(ucs_name);
+ talloc_free(ucs_name);
return status;
}