From c74579f49149171e731ae9b5a8e77c579d120cbb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 24 Dec 2007 00:53:22 +0100 Subject: Make libnet_smbconf_key_exists() use talloc_stackframe(). And not pass a talloc context. Michael (This used to be commit 7e8451f2f03b246801783aaf4b3d54465292f8f7) --- source3/libnet/libnet_conf.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'source3/libnet') diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c index d9a9e7de9b..26e17f2ea3 100644 --- a/source3/libnet/libnet_conf.c +++ b/source3/libnet/libnet_conf.c @@ -62,24 +62,18 @@ done: /* * check if a subkey of KEY_SMBCONF of a given name exists */ -bool libnet_smbconf_key_exists(TALLOC_CTX *ctx, const char *subkeyname) +bool libnet_smbconf_key_exists(const char *subkeyname) { bool ret = False; WERROR werr = WERR_OK; - TALLOC_CTX *mem_ctx; - struct registry_key *key; - - if (!(mem_ctx = talloc_new(ctx))) { - d_fprintf(stderr, "ERROR: Out of memory...!\n"); - goto done; - } + TALLOC_CTX *mem_ctx = talloc_stackframe(); + struct registry_key *key = NULL; werr = libnet_smbconf_open_path_q(mem_ctx, subkeyname, REG_KEY_READ, &key); if (W_ERROR_IS_OK(werr)) { ret = True; } -done: TALLOC_FREE(mem_ctx); return ret; } @@ -257,7 +251,7 @@ WERROR libnet_smbconf_setparm(TALLOC_CTX *mem_ctx, WERROR werr; struct registry_key *key = NULL; - if (!libnet_smbconf_key_exists(mem_ctx, service)) { + if (!libnet_smbconf_key_exists(service)) { werr = libnet_smbconf_reg_createkey_internal(mem_ctx, service, &key); } else { @@ -279,7 +273,7 @@ WERROR libnet_smbconf_getparm(TALLOC_CTX *mem_ctx, WERROR werr; struct registry_key *key = NULL; - if (!libnet_smbconf_key_exists(mem_ctx, service)) { + if (!libnet_smbconf_key_exists(service)) { werr = WERR_NO_SUCH_SERVICE; goto done; } @@ -308,7 +302,7 @@ WERROR libnet_smbconf_delparm(TALLOC_CTX *mem_ctx, struct registry_key *key = NULL; WERROR werr = WERR_OK; - if (!libnet_smbconf_key_exists(mem_ctx, service)) { + if (!libnet_smbconf_key_exists(service)) { return WERR_NO_SUCH_SERVICE; } -- cgit