summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_winreg_spoolss.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-05-09 09:16:54 +0200
committerVolker Lendecke <vl@samba.org>2012-05-10 09:11:57 +0200
commit05e59739b30073173697974fcfebb871d04801ae (patch)
tree08c4adb6b9c7a5d0b4d21fa47635b4256006570f /source3/rpc_client/cli_winreg_spoolss.c
parent8c2f826553d35fb69cb570ee1b92a2792b603f86 (diff)
downloadsamba-05e59739b30073173697974fcfebb871d04801ae.tar.gz
samba-05e59739b30073173697974fcfebb871d04801ae.tar.bz2
samba-05e59739b30073173697974fcfebb871d04801ae.zip
s3: Fix Coverity ID 242691 Dereference before null check
winreg_printer_openkey above already dereferences winreg_handle
Diffstat (limited to 'source3/rpc_client/cli_winreg_spoolss.c')
-rw-r--r--source3/rpc_client/cli_winreg_spoolss.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c
index 2686c60e62..a0bbd91c7d 100644
--- a/source3/rpc_client/cli_winreg_spoolss.c
+++ b/source3/rpc_client/cli_winreg_spoolss.c
@@ -1619,6 +1619,7 @@ WERROR winreg_get_printer_secdesc(TALLOC_CTX *mem_ctx,
TALLOC_CTX *tmp_ctx;
NTSTATUS status;
WERROR result;
+ WERROR ignore;
tmp_ctx = talloc_stackframe();
if (tmp_ctx == NULL) {
@@ -1660,7 +1661,6 @@ WERROR winreg_get_printer_secdesc(TALLOC_CTX *mem_ctx,
}
if (!W_ERROR_IS_OK(result)) {
if (W_ERROR_EQUAL(result, WERR_BADFILE)) {
- WERROR ignore;
if (is_valid_policy_hnd(&key_hnd)) {
dcerpc_winreg_CloseKey(winreg_handle,
@@ -1758,15 +1758,11 @@ create_default:
result = WERR_OK;
done:
- if (winreg_handle != NULL) {
- WERROR ignore;
-
- if (is_valid_policy_hnd(&key_hnd)) {
- dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
- }
- if (is_valid_policy_hnd(&hive_hnd)) {
- dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
- }
+ if (is_valid_policy_hnd(&key_hnd)) {
+ dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &key_hnd, &ignore);
+ }
+ if (is_valid_policy_hnd(&hive_hnd)) {
+ dcerpc_winreg_CloseKey(winreg_handle, tmp_ctx, &hive_hnd, &ignore);
}
talloc_free(tmp_ctx);