Skip to content

Commit

Permalink
randr: handle RRSetCrtcConfigs request with zero configs
Browse files Browse the repository at this point in the history
Need to actually return a reply in this case.

Signed-off-by: Keith Packard <[email protected]>
Reviewed-by: Aaron Plattner <[email protected]>
  • Loading branch information
keith-packard committed Dec 7, 2010
1 parent b0f4bd6 commit 0d01b66
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions randr/rrcrtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1750,17 +1750,14 @@ ProcRRSetCrtcConfigs (ClientPtr client)
screen_config.mm_width = stuff->widthInMillimeters;
screen_config.mm_height = stuff->heightInMillimeters;

if (num_configs == 0)
return Success;

output_ids = (RROutput *) (x_configs + num_configs);

/*
* Convert protocol crtc configurations into
* server crtc configurations
*/
configs = calloc(num_configs, sizeof (RRCrtcConfigRec));
if (!configs)
if (num_configs > 0 && configs == NULL)
return BadAlloc;
for (i = 0; i < num_configs; i++) {
rc = RRConvertCrtcConfig(client, screen, &screen_config,
Expand All @@ -1773,7 +1770,8 @@ ProcRRSetCrtcConfigs (ClientPtr client)
output_ids += x_configs[i].nOutput;
}

if (!RRSetCrtcConfigs (screen, &screen_config, configs, num_configs))
if (num_configs &&
!RRSetCrtcConfigs (screen, &screen_config, configs, num_configs))
{
rep.status = RRSetConfigFailed;
goto sendReply;
Expand Down

0 comments on commit 0d01b66

Please sign in to comment.