Skip to content

Commit

Permalink
cairo-test-runner: don't leak argv
Browse files Browse the repository at this point in the history
If CAIRO_TESTS is set, argv will be replaced by a xmaloc'ed variable. We
need to free it.

This can be easily detected by running:
CAIRO_TESTS=user-font make check-valgrind TARGETS=image

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
  • Loading branch information
Paulo Zanoni authored and Chris Wilson committed Sep 9, 2011
1 parent 572479e commit ee15e03
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/cairo-test-runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ main (int argc, char **argv)
unsigned int n, m;
char targets[4096];
int len;
char *cairo_tests_env;

#ifdef _MSC_VER
/* We don't want an assert dialog, we want stderr */
Expand Down Expand Up @@ -752,7 +753,9 @@ main (int argc, char **argv)
}

_parse_cmdline (&runner, &argc, &argv);
append_argv (&argc, &argv, getenv ("CAIRO_TESTS"));

cairo_tests_env = getenv("CAIRO_TESTS");
append_argv (&argc, &argv, cairo_tests_env);

if (runner.full_test) {
runner.num_device_offsets = 2;
Expand Down Expand Up @@ -1072,6 +1075,9 @@ main (int argc, char **argv)

}

if (cairo_tests_env)
free(argv);

if (runner.list_only) {
printf ("\n");
return CAIRO_TEST_SUCCESS;
Expand Down

0 comments on commit ee15e03

Please sign in to comment.