From 3a8c4ab2adaed1080e3448cd82d22c71c248c97e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 May 2012 09:16:54 +0200 Subject: s3: Fix Coverity ID 242698 Dereference before null check winreg_printer_openkey above already dereferences winreg_handle --- source3/rpc_client/cli_winreg_spoolss.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'source3/rpc_client') diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c index 8667692321..51cdb1298c 100644 --- a/source3/rpc_client/cli_winreg_spoolss.c +++ b/source3/rpc_client/cli_winreg_spoolss.c @@ -936,6 +936,7 @@ WERROR winreg_update_printer(TALLOC_CTX *mem_ctx, DATA_BLOB blob; char *path; WERROR result = WERR_OK; + WERROR ignore; NTSTATUS status; TALLOC_CTX *tmp_ctx; @@ -1318,15 +1319,11 @@ WERROR winreg_update_printer(TALLOC_CTX *mem_ctx, 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