summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2016-03-10 09:29:19 -0500
committerAdam Jackson <ajax@redhat.com>2016-03-14 15:34:16 -0400
commit5f11a5860668b1384657aca51c750520594e333e (patch)
treef5d8690e2c0eb57ac80fe1881a1011e8302f3cf8
parent3d7add9804c10f5c0555e4cf86dbddc11b3b1c6e (diff)
Be valgrind-clean
Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
-rw-r--r--main.c16
-rw-r--r--t_gtk_argb_xbgr.c6
-rw-r--r--t_libreoffice_xrgb.c1
-rw-r--r--tests.c20
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);