From acf9d61421faa6c0055d57fdee7db300dc5431aa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 7 Dec 2004 18:25:53 +0000 Subject: r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a) --- source3/passdb/secrets.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/passdb/secrets.c') diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 426217b82c..6be63e4f9d 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -346,7 +346,7 @@ BOOL secrets_fetch_trusted_domain_password(const char *domain, char** pwd, /* the trust's password */ if (pwd) { - *pwd = strdup(pass.pass); + *pwd = SMB_STRDUP(pass.pass); if (!*pwd) { return False; } @@ -577,7 +577,7 @@ NTSTATUS secrets_get_trusted_domains(TALLOC_CTX* ctx, int* enum_ctx, unsigned in size_t size, packed_size = 0; fstring dom_name; char *packed_pass; - struct trusted_dom_pass *pass = talloc_zero(ctx, sizeof(struct trusted_dom_pass)); + struct trusted_dom_pass *pass = TALLOC_ZERO_P(ctx, struct trusted_dom_pass); NTSTATUS status; if (!secrets_init()) return NT_STATUS_ACCESS_DENIED; @@ -599,7 +599,7 @@ NTSTATUS secrets_get_trusted_domains(TALLOC_CTX* ctx, int* enum_ctx, unsigned in DEBUG(5, ("secrets_get_trusted_domains: looking for %d domains, starting at index %d\n", max_num_domains, *enum_ctx)); - *domains = talloc_zero(ctx, sizeof(**domains)*max_num_domains); + *domains = TALLOC_ZERO_ARRAY(ctx, TRUSTDOM *, max_num_domains); /* fetching trusted domains' data and collecting them in a list */ keys = tdb_search_keys(tdb, pattern); @@ -615,7 +615,7 @@ NTSTATUS secrets_get_trusted_domains(TALLOC_CTX* ctx, int* enum_ctx, unsigned in char *secrets_key; /* important: ensure null-termination of the key string */ - secrets_key = strndup(k->node_key.dptr, k->node_key.dsize); + secrets_key = SMB_STRNDUP(k->node_key.dptr, k->node_key.dsize); if (!secrets_key) { DEBUG(0, ("strndup failed!\n")); return NT_STATUS_NO_MEMORY; @@ -638,7 +638,7 @@ NTSTATUS secrets_get_trusted_domains(TALLOC_CTX* ctx, int* enum_ctx, unsigned in SAFE_FREE(secrets_key); if (idx >= start_idx && idx < start_idx + max_num_domains) { - dom = talloc_zero(ctx, sizeof(*dom)); + dom = TALLOC_ZERO_P(ctx, TRUSTDOM); if (!dom) { /* free returned tdb record */ return NT_STATUS_NO_MEMORY; -- cgit