diff options
author | Volker Lendecke <vl@samba.org> | 2012-05-09 09:16:54 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2012-05-10 09:11:57 +0200 |
commit | 05e59739b30073173697974fcfebb871d04801ae (patch) | |
tree | 08c4adb6b9c7a5d0b4d21fa47635b4256006570f | |
parent | 8c2f826553d35fb69cb570ee1b92a2792b603f86 (diff) | |
download | samba-05e59739b30073173697974fcfebb871d04801ae.tar.gz samba-05e59739b30073173697974fcfebb871d04801ae.tar.xz samba-05e59739b30073173697974fcfebb871d04801ae.zip |
s3: Fix Coverity ID 242691 Dereference before null check
winreg_printer_openkey above already dereferences winreg_handle
-rw-r--r-- | source3/rpc_client/cli_winreg_spoolss.c | 16 |
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 2686c60e62f..a0bbd91c7d0 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); |