summaryrefslogtreecommitdiff
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:56 +0200
commit39577f1e99900c95561fa137e23c0488660bcf5e (patch)
treecd4180c92d92bd1990488205dcb0ddd5f4571991
parent600c4c9c45396f2521f413abb0a4e1a3567b869c (diff)
downloadsamba-39577f1e99900c95561fa137e23c0488660bcf5e.tar.gz
samba-39577f1e99900c95561fa137e23c0488660bcf5e.tar.bz2
samba-39577f1e99900c95561fa137e23c0488660bcf5e.zip
s3: Fix Coverity ID 242695 Dereference before null check
winreg_printer_openkey above already dereferences winreg_handle
-rw-r--r--source3/rpc_client/cli_winreg_spoolss.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c
index 1d90d5e69e..1cf034e9f2 100644
--- a/source3/rpc_client/cli_winreg_spoolss.c
+++ b/source3/rpc_client/cli_winreg_spoolss.c
@@ -1348,6 +1348,7 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
char *path;
NTSTATUS status;
WERROR result = WERR_OK;
+ WERROR ignore;
const char **enum_names = NULL;
enum winreg_Type *enum_types = NULL;
DATA_BLOB *enum_data_blobs = NULL;
@@ -1595,15 +1596,11 @@ WERROR winreg_get_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);