From 2c457eca252fd62a3429ca3db172b85c534bd2d7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 22 Jul 2005 10:58:49 +0000 Subject: r8712: cleanup old search test code to use talloc (This used to be commit 1d830bcd473a2166b6f89281faabb001697e35d4) --- source4/torture/raw/search.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'source4') diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c index cb6cf6336e..235ce81660 100644 --- a/source4/torture/raw/search.c +++ b/source4/torture/raw/search.c @@ -625,14 +625,14 @@ static BOOL test_many_files(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Creating %d files\n", num_files); for (i=0;itree, fname, O_CREAT|O_RDWR, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); ret = False; goto done; } - free(fname); + talloc_free(fname); smbcli_close(cli->tree, fnum); } @@ -685,13 +685,13 @@ static BOOL test_many_files(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } else { s = result.list[i].search.name; } - asprintf(&fname, "t%03d-%d.txt", i, i); + fname = talloc_asprintf(cli, "t%03d-%d.txt", i, i); if (strcmp(fname, s)) { printf("Incorrect name %s at entry %d\n", s, i); ret = False; break; } - free(fname); + talloc_free(fname); } talloc_free(result.mem_ctx); } @@ -758,14 +758,14 @@ static BOOL test_modify_search(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Creating %d files\n", num_files); for (i=num_files-1;i>=0;i--) { - asprintf(&fname, BASEDIR "\\t%03d-%d.txt", i, i); + fname = talloc_asprintf(cli, BASEDIR "\\t%03d-%d.txt", i, i); fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); ret = False; goto done; } - free(fname); + talloc_free(fname); smbcli_close(cli->tree, fnum); } @@ -876,14 +876,14 @@ static BOOL test_sorted(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Creating %d files\n", num_files); for (i=0;itree, fname, O_CREAT|O_RDWR, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); ret = False; goto done; } - free(fname); + talloc_free(fname); smbcli_close(cli->tree, fnum); } @@ -939,7 +939,7 @@ static BOOL test_many_dirs(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Creating %d dirs\n", num_dirs); for (i=0;itree, dname); if (!NT_STATUS_IS_OK(status)) { printf("(%s) Failed to create %s - %s\n", @@ -949,7 +949,7 @@ static BOOL test_many_dirs(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } for (n=0;n<3;n++) { - asprintf(&fname, BASEDIR "\\d%d\\f%d-%d.txt", i, i, n); + fname = talloc_asprintf(cli, BASEDIR "\\d%d\\f%d-%d.txt", i, i, n); fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE); if (fnum == -1) { printf("(%s) Failed to create %s - %s\n", @@ -957,11 +957,11 @@ static BOOL test_many_dirs(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) ret = False; goto done; } - free(fname); + talloc_free(fname); smbcli_close(cli->tree, fnum); } - free(dname); + talloc_free(dname); } file = talloc_zero_array(mem_ctx, union smb_search_data, num_dirs); @@ -1103,14 +1103,14 @@ static BOOL test_os2_delete(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) printf("Testing OS/2 style delete on %d files\n", num_files); for (i=0;itree, fname, O_CREAT|O_RDWR, DENY_NONE); if (fnum == -1) { printf("Failed to create %s - %s\n", fname, smbcli_errstr(cli->tree)); ret = False; goto done; } - free(fname); + talloc_free(fname); smbcli_close(cli->tree, fnum); } @@ -1130,10 +1130,11 @@ static BOOL test_os2_delete(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) CHECK_STATUS(status, NT_STATUS_OK); for (i=0;itree, fname); CHECK_STATUS(status, NT_STATUS_OK); total_deleted++; + talloc_free(fname); } io2.t2fnext.level = RAW_SEARCH_EA_SIZE; @@ -1154,10 +1155,11 @@ static BOOL test_os2_delete(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) } for (i=0;itree, fname); CHECK_STATUS(status, NT_STATUS_OK); total_deleted++; + talloc_free(fname); } if (i>0) { -- cgit