From 05e59739b30073173697974fcfebb871d04801ae Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 May 2012 09:16:54 +0200 Subject: s3: Fix Coverity ID 242691 Dereference before null check winreg_printer_openkey above already dereferences winreg_handle --- source3/rpc_client/cli_winreg_spoolss.c | 16 ++++++---------- 1 file 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); -- cgit