summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-07-25 22:31:08 +0200
committerAndreas Schneider <asn@samba.org>2011-07-27 08:49:58 +0200
commita0597b75e6794d8bfe7e43bf36378b2421afc9c7 (patch)
tree69e63ea71b0ec9f146d77179fa5a050edf38f3c6 /source3/rpc_client
parentfe7e4ac462608200a98c64338e7b5cddda2fda71 (diff)
downloadsamba-a0597b75e6794d8bfe7e43bf36378b2421afc9c7.tar.gz
samba-a0597b75e6794d8bfe7e43bf36378b2421afc9c7.tar.bz2
samba-a0597b75e6794d8bfe7e43bf36378b2421afc9c7.zip
s3-rpc_client: Close hive if opening of the key fails.
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_winreg_spoolss.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c
index 9b7c72421c..d0c048c3cc 100644
--- a/source3/rpc_client/cli_winreg_spoolss.c
+++ b/source3/rpc_client/cli_winreg_spoolss.c
@@ -298,9 +298,19 @@ static WERROR winreg_printer_openkey(TALLOC_CTX *mem_ctx,
&result);
}
if (!NT_STATUS_IS_OK(status)) {
- return ntstatus_to_werror(status);
+ result = ntstatus_to_werror(status);
}
if (!W_ERROR_IS_OK(result)) {
+ WERROR ignore;
+
+ if (is_valid_policy_hnd(hive_handle)) {
+ dcerpc_winreg_CloseKey(binding_handle,
+ mem_ctx,
+ hive_handle,
+ &ignore);
+ }
+ ZERO_STRUCTP(hive_handle);
+
return result;
}