summaryrefslogtreecommitdiff
path: root/glamor
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2018-04-02 16:41:19 +0100
committerAdam Jackson <ajax@redhat.com>2018-04-10 15:42:40 -0400
commit150e4b12ad160b093899107ed586aa0cb258879e (patch)
tree41ccd521b59bed12e2f6a8e9e10805a63a189e38 /glamor
parentb36a14c0b0e7e38406622eb5ff0666a8b8bc50f4 (diff)
glamor: 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: cef12efc15c ("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>
Diffstat (limited to 'glamor')
-rw-r--r--glamor/glamor_egl.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index 3d102ad22..7050bd001 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -640,31 +640,27 @@ glamor_get_modifiers(ScreenPtr screen, CARD32 format,
struct glamor_egl_screen_private *glamor_egl;
EGLint num;
+ /* Explicitly zero the count as the caller may ignore the return value */
+ *num_modifiers = 0;
+
glamor_egl = glamor_egl_get_screen_private(xf86ScreenToScrn(screen));
if (!glamor_egl->dmabuf_capable)
return FALSE;
if (!eglQueryDmaBufModifiersEXT(glamor_egl->display, format, 0, NULL,
- NULL, &num)) {
- *num_modifiers = 0;
+ NULL, &num))
return FALSE;
- }
- if (num == 0) {
- *num_modifiers = 0;
+ if (num == 0)
return TRUE;
- }
*modifiers = calloc(num, sizeof(uint64_t));
- if (*modifiers == NULL) {
- *num_modifiers = 0;
+ if (*modifiers == NULL)
return FALSE;
- }
if (!eglQueryDmaBufModifiersEXT(glamor_egl->display, format, num,
(EGLuint64KHR *) *modifiers, NULL, &num)) {
- *num_modifiers = 0;
free(*modifiers);
return FALSE;
}