From: Emil Velikov <emil.veli...@collabora.com>

Call eglTerminate, otherwise we'll end up with massive leaks reported in
Valgrind. Fairly useful when checking if the EGL implementation is
leak-free.

Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
 .../egl_ext_device_query.c                    | 20 +++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tests/egl/spec/egl_ext_device_query/egl_ext_device_query.c 
b/tests/egl/spec/egl_ext_device_query/egl_ext_device_query.c
index a6f5fa815..5887d1e02 100644
--- a/tests/egl/spec/egl_ext_device_query/egl_ext_device_query.c
+++ b/tests/egl/spec/egl_ext_device_query/egl_ext_device_query.c
@@ -77,37 +77,49 @@ main(void)
        }
 
        queryDisplayAttrib(dpy, 0xbad1dea, (EGLAttrib *)&device);
-       if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE))
+       if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE)) {
+               eglTerminate(dpy);
                piglit_report_result(PIGLIT_FAIL);
+       }
 
        if (!queryDisplayAttrib(dpy, EGL_DEVICE_EXT, (EGLAttrib *)&device)) {
                printf("Failed to query display\n");
+               eglTerminate(dpy);
                piglit_report_result(PIGLIT_FAIL);
        }
 
        if (device == EGL_NO_DEVICE_EXT) {
                printf("Got no device handle\n");
+               eglTerminate(dpy);
                piglit_report_result(PIGLIT_FAIL);
        }
 
        queryDeviceAttrib(device, 0xbad1dea, &attr);
-       if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE))
+       if (!piglit_check_egl_error(EGL_BAD_ATTRIBUTE)) {
+               eglTerminate(dpy);
                piglit_report_result(PIGLIT_FAIL);
+       }
 
        devstring = queryDeviceString(device, 0xbad1dea);
-       if (!piglit_check_egl_error(EGL_BAD_PARAMETER))
+       if (!piglit_check_egl_error(EGL_BAD_PARAMETER)) {
+               eglTerminate(dpy);
                piglit_report_result(PIGLIT_FAIL);
+       }
 
        devstring = queryDeviceString(EGL_NO_DEVICE_EXT, EGL_EXTENSIONS);
-       if (!piglit_check_egl_error(EGL_BAD_DEVICE_EXT))
+       if (!piglit_check_egl_error(EGL_BAD_DEVICE_EXT)) {
+               eglTerminate(dpy);
                piglit_report_result(PIGLIT_FAIL);
+       }
 
        devstring = queryDeviceString(device, EGL_EXTENSIONS);
        if (devstring == NULL) {
                printf("Empty device extension string\n");
+               eglTerminate(dpy);
                piglit_report_result(PIGLIT_WARN);
        }
 
+       eglTerminate(dpy);
        printf("Device extension string: %s\n", devstring);
        piglit_report_result(PIGLIT_PASS);
 }
-- 
2.18.0

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to