When dcerpc_winreg_enumvals() returns 0 values, the loop is skipped
but the error check still tries to dereference 'v' (which was never
initialized).
Add a guard to only check error status if num_values > 0, and reset
the result to WERR_OK on success to prevent spurious error handling.
Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
CHECK_ERROR(result);
}
- if (!W_ERROR_IS_OK(result)) {
+ if (num_values > 0 && !W_ERROR_IS_OK(result)) {
DEBUG(0, ("winreg_get_printer: winreg_enumval_to_TYPE() failed "
"for %s: %s\n",
v->value_name,
goto done;
}
+ result = WERR_OK;
+
/* Construct the Device Mode */
status = dcerpc_winreg_query_binary(tmp_ctx,
winreg_handle,