diff options
author | Adam Jackson <ajax@redhat.com> | 2016-03-10 09:29:19 -0500 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-03-14 15:34:16 -0400 |
commit | 5f11a5860668b1384657aca51c750520594e333e (patch) | |
tree | f5d8690e2c0eb57ac80fe1881a1011e8302f3cf8 | |
parent | 3d7add9804c10f5c0555e4cf86dbddc11b3b1c6e (diff) |
Be valgrind-clean
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r-- | main.c | 16 | ||||
-rw-r--r-- | t_gtk_argb_xbgr.c | 6 | ||||
-rw-r--r-- | t_libreoffice_xrgb.c | 1 | ||||
-rw-r--r-- | tests.c | 20 |
4 files changed, 37 insertions, 6 deletions
@@ -31,7 +31,7 @@ bool is_verbose = false, minimalrendering = false; int enabled_tests = ~0; /* Enable all tests by default */ int format_whitelist_len = 0; -char **format_whitelist; +char **format_whitelist = NULL; /* Number of times to repeat operations so that pixmaps will tend to get moved * into offscreen memory and allow hardware acceleration. @@ -173,7 +173,7 @@ int main(int argc, char **argv) { Display *dpy; XEvent ev; - int i, o, maj, min; + int i, o, maj, min, ret = 1; static int is_sync = false, print_version = false; static int longopt_minimalrendering = 0; XWindowAttributes a; @@ -346,12 +346,18 @@ int main(int argc, char **argv) while (XNextEvent(dpy, &ev) == 0) { if (ev.type == Expose && !ev.xexpose.count) { if (do_tests(dpy, &window)) - exit(0); + ret = 0; else - exit(1); + ret = 1; + break; } } + free(window.name); + for (i = 0; i < format_whitelist_len; i++) + free(format_whitelist[i]); + free(format_whitelist); + XCloseDisplay(dpy); - return 0; + return ret; } diff --git a/t_gtk_argb_xbgr.c b/t_gtk_argb_xbgr.c index f19dfea..e95cb85 100644 --- a/t_gtk_argb_xbgr.c +++ b/t_gtk_argb_xbgr.c @@ -149,6 +149,12 @@ test_gtk_argb_xbgr(Display *dpy) } } + free(image_32->data); + XFree(image_32); + XFree(image_24->data); + XFree(image_24); + XFreeGC(dpy, gc_32); + record_result(&result, true); return result; } diff --git a/t_libreoffice_xrgb.c b/t_libreoffice_xrgb.c index 1398a01..3196078 100644 --- a/t_libreoffice_xrgb.c +++ b/t_libreoffice_xrgb.c @@ -160,6 +160,7 @@ libreoffice_xrgb_test_one(Display *dpy, bool invert) } } XDestroyImage(image); + XFreeGC(dpy, gc); return true; } @@ -243,7 +243,7 @@ create_formats_list(Display *dpy) memset(&templ, 0, sizeof(templ)); templ.type = PictTypeDirect; - formats = malloc(sizeof(*formats) * nformats_allocated); + formats = calloc(sizeof(*formats), nformats_allocated); if (formats == NULL) errx(1, "malloc error"); nformats = 0; @@ -745,6 +745,24 @@ do { \ success_mask |= TEST_BUG7366; } + for (i = 0; i < num_colors * nformats; i++) { + free(pictures_1x1[i].name); + free(pictures_10x10[i].name); + } + free(pictures_1x1); + free(pictures_10x10); + free(pictures_solid); + + for (i = 0; i < num_dests; i++) { + free(dests[i].name); + } + free(dests); + + for (i = 0; i < nformats; i++) { + free(formats[i].name); + } + free(formats); + free(test_ops); free(test_src); free(test_mask); |