summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}