From: Volker Lendecke Date: Wed, 7 Apr 2021 15:41:11 +0000 (+0000) Subject: printing: Straighten winreg_get_printer() slightly X-Git-Tag: tevent-0.11.0~1106 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c61316c94676da40c54d9db421f350f02871c4c1;p=thirdparty%2Fsamba.git printing: Straighten winreg_get_printer() slightly 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c index b84bbae2ceb..65ed0e8fd2f 100644 --- a/source3/rpc_client/cli_winreg_spoolss.c +++ b/source3/rpc_client/cli_winreg_spoolss.c @@ -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,