Signed-off-by: Adam Jackson <[email protected]>
---
 main.c               | 16 +++++++++++-----
 t_gtk_argb_xbgr.c    |  6 ++++++
 t_libreoffice_xrgb.c |  1 +
 tests.c              | 20 +++++++++++++++++++-
 4 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/main.c b/main.c
index 4cec99b..0d3d146 100644
--- a/main.c
+++ b/main.c
@@ -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;
 }
diff --git a/tests.c b/tests.c
index ff2bbd8..cca96b4 100644
--- a/tests.c
+++ b/tests.c
@@ -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);
-- 
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