printing: Straighten winreg_get_printer() slightly
authorVolker Lendecke <vl@samba.org>
Wed, 7 Apr 2021 15:41:11 +0000 (15:41 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 19 Apr 2021 18:18:31 +0000 (18:18 +0000)
Use the common done: exit for everything. This involves initializing
the handles on the stack, but this is good practice anyway.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpc_client/cli_winreg_spoolss.c

index b84bbae2ceb089015b3a374b0d8a96f8b1d42e80..65ed0e8fd2f18187adb2ee5bcb1df66f61b96f6b 100644 (file)
@@ -1479,7 +1479,8 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
 {
        struct spoolss_PrinterInfo2 *info2;
        uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
-       struct policy_handle hive_hnd, key_hnd;
+       struct policy_handle hive_hnd = { .handle_type = 0 };
+       struct policy_handle key_hnd = { .handle_type = 0 };
        struct spoolss_PrinterEnumValues enum_value;
        struct spoolss_PrinterEnumValues *v = NULL;
        enum ndr_err_code ndr_err;
@@ -1503,8 +1504,8 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
 
        path = winreg_printer_data_keyname(tmp_ctx, printer);
        if (path == NULL) {
-               TALLOC_FREE(tmp_ctx);
-               return WERR_NOT_ENOUGH_MEMORY;
+               result = WERR_NOT_ENOUGH_MEMORY;
+               goto done;
        }
 
        result = winreg_printer_openkey(tmp_ctx,