diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index a869ed4..116d503 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -543,8 +543,11 @@ static WERROR regf_get_value(TALLOC_CTX *ctx, struct hive_key *key, if (vk->data_length & 0x80000000) { vk->data_length &=~0x80000000; - data->data = (uint8_t *)&vk->data_offset; + data->data = talloc_size(ctx, vk->data_length); + memcpy(data->data, (uint8_t *)&vk->data_offset, vk->data_length); data->length = vk->data_length; + //data->data = (uint8_t *)&vk->data_offset; + //data->length = 0; } else { *data = hbin_get(regf, vk->data_offset); } @@ -2045,7 +2048,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location, struct tdr_pull *pull; int i; - regf = (struct regf_data *)talloc_zero(NULL, struct regf_data); + regf = (struct regf_data *)talloc_zero(parent_ctx, struct regf_data); regf->iconv_convenience = iconv_convenience; diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c index c9f1248..d997cb0 100644 --- a/source4/lib/registry/tools/common.c +++ b/source4/lib/registry/tools/common.c @@ -51,7 +51,7 @@ struct registry_key *reg_common_open_file(const char *path, struct registry_context *h = NULL; WERROR error; - error = reg_open_hive(NULL, path, NULL, creds, ev_ctx, lp_ctx, &hive_root); + error = reg_open_hive(ev_ctx, path, NULL, creds, ev_ctx, lp_ctx, &hive_root); if(!W_ERROR_IS_OK(error)) { fprintf(stderr, "Unable to open '%s': %s \n", diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c index cca009a..0abba39 100644 --- a/source4/lib/registry/tools/regtree.c +++ b/source4/lib/registry/tools/regtree.c @@ -55,13 +55,16 @@ static void print_tree(int level, struct registry_key *p, &keyname, NULL, NULL)); i++) { - SMB_ASSERT(strlen(keyname) > 0); + + SMB_ASSERT(strlen(keyname) > 0); if (!W_ERROR_IS_OK(reg_open_key(mem_ctx, p, keyname, &subkey))) - continue; + continue; + print_tree(level+1, subkey, (fullpath && strlen(name))? - talloc_asprintf(mem_ctx, "%s\\%s", - name, keyname): - keyname, fullpath, novals); + talloc_asprintf(mem_ctx, "%s\\%s", + name, keyname): + keyname, fullpath, novals); + talloc_free(subkey); } talloc_free(mem_ctx); @@ -119,6 +122,7 @@ int main(int argc, char **argv) { NULL } }; + talloc_enable_leak_report_full(); pc = poptGetContext(argv[0], argc, (const char **) argv, long_options,0); while((opt = poptGetNextOpt(pc)) != -1) { @@ -134,8 +138,9 @@ int main(int argc, char **argv) h = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx); } - if (h == NULL && start_key == NULL) - return 1; + if (h == NULL && start_key == NULL) { + return 1; + }; poptFreeContext(pc); @@ -160,5 +165,6 @@ int main(int argc, char **argv) } } + //talloc_free(ev_ctx); return 0; }