xwayland: zero num_modifiers from the start
The caller may ignore the return value (will be addressed with later
commit) so simply zero the count from the get-go. We're pretty much do
so, in all cases but one :-\
Fixes: cef12efc15
("glamor: Implement GetSupportedModifiers")
Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Cc: Daniel Stone <daniels@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
parent
a83ceec868
commit
b36a14c0b0
|
@ -779,13 +779,14 @@ glamor_get_modifiers(ScreenPtr screen, CARD32 format,
|
|||
struct xwl_format *xwl_format = NULL;
|
||||
int i;
|
||||
|
||||
/* Explicitly zero the count as the caller may ignore the return value */
|
||||
*num_modifiers = 0;
|
||||
|
||||
if (!xwl_screen->dmabuf_capable || !xwl_screen->dmabuf)
|
||||
return FALSE;
|
||||
|
||||
if (xwl_screen->num_formats == 0) {
|
||||
*num_modifiers = 0;
|
||||
return TRUE;
|
||||
}
|
||||
if (xwl_screen->num_formats == 0)
|
||||
return TRUE;
|
||||
|
||||
for (i = 0; i < xwl_screen->num_formats; i++) {
|
||||
if (xwl_screen->formats[i].format == format) {
|
||||
|
@ -794,16 +795,12 @@ glamor_get_modifiers(ScreenPtr screen, CARD32 format,
|
|||
}
|
||||
}
|
||||
|
||||
if (!xwl_format) {
|
||||
*num_modifiers = 0;
|
||||
if (!xwl_format)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*modifiers = calloc(xwl_format->num_modifiers, sizeof(uint64_t));
|
||||
if (*modifiers == NULL) {
|
||||
*num_modifiers = 0;
|
||||
if (*modifiers == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < xwl_format->num_modifiers; i++)
|
||||
(*modifiers)[i] = xwl_format->modifiers[i];
|
||||
|
|
Loading…
Reference in New Issue
Block a user