r2909: fix some RAW-SEARCH torture mem leaks
authorAndrew Tridgell <tridge@samba.org>
Mon, 11 Oct 2004 09:23:19 +0000 (09:23 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:59:47 +0000 (12:59 -0500)
(This used to be commit 75ca5ba5091c9046159531b917ff17a519013556)

source4/torture/raw/search.c

index e5c682575c746f7d148aa36f2d5e948e203c0407..2d73c8e34e3a3ddd34099b14c73f89603db0ed0b 100644 (file)
@@ -629,7 +629,7 @@ static BOOL test_many_files(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 
        for (t=0;t<ARRAY_SIZE(search_types);t++) {
                ZERO_STRUCT(result);
-               result.mem_ctx = mem_ctx;
+               result.mem_ctx = talloc(mem_ctx, 0);
        
                printf("Continue %s via %s\n", search_types[t].name, search_types[t].cont_name);
 
@@ -683,7 +683,7 @@ static BOOL test_many_files(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
                        }
                        free(fname);
                }
-               talloc_free(result.list);
+               talloc_free(result.mem_ctx);
        }
 
 done:
@@ -705,7 +705,7 @@ static BOOL check_result(struct multiple_result *result, const char *name, BOOL
        if (i == result->count) {
                if (exist) {
                        printf("failed: '%s' should exist with attribute %s\n", 
-                              name, attrib_string(NULL, attrib));
+                              name, attrib_string(result->list, attrib));
                        return False;
                }
                return True;
@@ -713,7 +713,7 @@ static BOOL check_result(struct multiple_result *result, const char *name, BOOL
 
        if (!exist) {
                printf("failed: '%s' should NOT exist (has attribute %s)\n", 
-                      name, attrib_string(NULL, result->list[i].both_directory_info.attrib));
+                      name, attrib_string(result->list, result->list[i].both_directory_info.attrib));
                return False;
        }
 
@@ -763,6 +763,7 @@ static BOOL test_modify_search(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
 
        printf("pulling the first 10 files\n");
        ZERO_STRUCT(result);
+       result.mem_ctx = talloc(mem_ctx, 0);
 
        io.generic.level = RAW_SEARCH_BOTH_DIRECTORY_INFO;
        io.t2ffirst.in.search_attrib = 0;