Without this, trying to test eg. just r5g6b5 would fail, because we'd
ignore anything we didn't whitelist.

Signed-off-by: Adam Jackson <[email protected]>
---
 tests.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/tests.c b/tests.c
index cca96b4..9c8adaf 100644
--- a/tests.c
+++ b/tests.c
@@ -279,6 +279,11 @@ create_formats_list(Display *dpy)
 
        describe_format(&formats[nformats].name, NULL, format);
 
+       if (format == XRenderFindStandardFormat(dpy, PictStandardARGB32))
+       {
+           argb32index = nformats;
+       }
+
        if (format_whitelist_len != 0) {
            bool ok = false;
            int j;
@@ -292,17 +297,14 @@ create_formats_list(Display *dpy)
            if (!ok) {
                printf("Ignoring server-supported format: %s\n",
                       formats[nformats].name);
-               free(formats[nformats].name);
-               formats[nformats].name = NULL;
+               if (nformats != argb32index) {
+                   free(formats[nformats].name);
+                   formats[nformats].name = NULL;
+               }
                continue;
            }
        }
 
-       if (format == XRenderFindStandardFormat(dpy, PictStandardARGB32))
-       {
-           argb32index = nformats;
-       }
-
        printf("Found server-supported format: %s\n", formats[nformats].name);
 
        nformats++;
-- 
2.5.0

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to