s3: Fix Coverity ID 242700 Dereference before null check
authorVolker Lendecke <vl@samba.org>
Wed, 9 May 2012 07:16:54 +0000 (09:16 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 10 May 2012 07:11:56 +0000 (09:11 +0200)
winreg_printer_openkey above already dereferences winreg_handle

source3/rpc_client/cli_winreg_spoolss.c

index 2b7215f9f466413eaeca8eb3db5eb4f80c0e4902..fa7096cf77cd855acefa4e8bedf2282eef2536db 100644 (file)
@@ -2371,6 +2371,7 @@ WERROR winreg_delete_printer_key(TALLOC_CTX *mem_ctx,
        char *keyname;
        char *path;
        WERROR result;
+       WERROR ignore;
        NTSTATUS status;
        TALLOC_CTX *tmp_ctx;
 
@@ -2443,15 +2444,11 @@ WERROR winreg_delete_printer_key(TALLOC_CTX *mem_ctx,
        }
 
 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);