summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-01-03 01:26:31 +0100
committerMichael Adam <obnox@samba.org>2008-01-03 01:29:43 +0100
commitad1cc905b2eef9ebfe727a6061aec62a22574c8b (patch)
tree536512b8cb5268efa5fb8131ce776d217da28a92 /source3
parent3c9f7c7a64e886ae54beb4242b227a9a223520e1 (diff)
downloadsamba-ad1cc905b2eef9ebfe727a6061aec62a22574c8b.tar.gz
samba-ad1cc905b2eef9ebfe727a6061aec62a22574c8b.tar.bz2
samba-ad1cc905b2eef9ebfe727a6061aec62a22574c8b.zip
Don't leak: Use a temporary context for the admin token and free it.
Michael (This used to be commit 9d7502115e0f6cdfd27943d52f0de04447582b92)
Diffstat (limited to 'source3')
-rw-r--r--source3/libnet/libnet_conf.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/libnet/libnet_conf.c b/source3/libnet/libnet_conf.c
index ca5b0c408f..995fc1b303 100644
--- a/source3/libnet/libnet_conf.c
+++ b/source3/libnet/libnet_conf.c
@@ -64,6 +64,7 @@ static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx,
{
WERROR werr = WERR_OK;
NT_USER_TOKEN *token;
+ TALLOC_CTX *tmp_ctx = NULL;
if (path == NULL) {
DEBUG(1, ("Error: NULL path string given\n"));
@@ -71,7 +72,13 @@ static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx,
goto done;
}
- token = registry_create_admin_token(mem_ctx);
+ tmp_ctx = talloc_new(mem_ctx);
+ if (tmp_ctx == NULL) {
+ werr = WERR_NOMEM;
+ goto done;
+ }
+
+ token = registry_create_admin_token(tmp_ctx);
if (token == NULL) {
DEBUG(1, ("Error creating admin token\n"));
/* what is the appropriate error code here? */
@@ -87,6 +94,7 @@ static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx,
}
done:
+ TALLOC_FREE(tmp_ctx);
return werr;
}