mirror of
https://github.com/samba-team/samba.git
synced 2025-08-30 17:49:30 +03:00
Don't leak: Use a temporary context for the admin token and free it.
Michael
(This used to be commit 9d7502115e
)
This commit is contained in:
@ -64,6 +64,7 @@ static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx,
|
|||||||
{
|
{
|
||||||
WERROR werr = WERR_OK;
|
WERROR werr = WERR_OK;
|
||||||
NT_USER_TOKEN *token;
|
NT_USER_TOKEN *token;
|
||||||
|
TALLOC_CTX *tmp_ctx = NULL;
|
||||||
|
|
||||||
if (path == NULL) {
|
if (path == NULL) {
|
||||||
DEBUG(1, ("Error: NULL path string given\n"));
|
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;
|
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) {
|
if (token == NULL) {
|
||||||
DEBUG(1, ("Error creating admin token\n"));
|
DEBUG(1, ("Error creating admin token\n"));
|
||||||
/* what is the appropriate error code here? */
|
/* what is the appropriate error code here? */
|
||||||
@ -87,6 +94,7 @@ static WERROR libnet_smbconf_reg_open_path(TALLOC_CTX *mem_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
TALLOC_FREE(tmp_ctx);
|
||||||
return werr;
|
return werr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user