Alexandre Julliard wrote:
Robert Shearman rob@codeweavers.com writes:
ChangeLog: The desktop variable could be NULL when set_process_default_desktop is called, so check for this. (Found by Coverity).
I don't see how this could happen. Did I miss something?
See below.
void connect_process_winstation( *struct* process *process, *struct* thread *parent ) { *struct* winstation *winstation = NULL; *struct* desktop *desktop = NULL; obj_handle_t handle;
//* check for an inherited winstation handle (don't ask...) *// *if* ((handle = find_inherited_handle( process, &winstation_ops ))) { winstation = (*struct* winstation *)get_handle_obj( process, handle, 0, &winstation_ops ); } *else* *if* (parent && parent->process->winstation) { handle = duplicate_handle( parent->process, parent->process->winstation, process, 0, 0, DUP_HANDLE_SAME_ACCESS ); winstation = (*struct* winstation *)get_handle_obj( process, handle, 0, &winstation_ops ); } *if* (!winstation) *goto* done; process->winstation = handle;
Handle is non-NULL here.
*if* ((handle = find_inherited_handle( process, &desktop_ops ))) { desktop = get_desktop_obj( process, handle, 0 ); *if* (!desktop || desktop->winstation != winstation) *goto* done; } *else* *if* (parent && parent->desktop) { desktop = get_desktop_obj( parent->process, parent->desktop, 0 ); *if* (!desktop || desktop->winstation != winstation) *goto* done; handle = duplicate_handle( parent->process, parent->desktop, process, 0, 0, DUP_HANDLE_SAME_ACCESS ); }
If the process neither has desktop nor its parent has a desktop then handle will be non-NULL here, yet desktop will be NULL.
*if* (handle) set_process_default_desktop( process, desktop, handle );
done: *if* (desktop) release_object( desktop ); *if* (winstation) release_object( winstation ); clear_error(); }