[Piglit] [PATCH 5/9] egl_ext_device_query: plug memory leaks
Emil Velikov
emil.l.velikov at gmail.com
Fri Aug 3 12:46:33 UTC 2018
From: Emil Velikov <emil.velikov at 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.velikov at 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
More information about the Piglit
mailing list