tests: Don't leak args when skipping tests

We treat the argv we pass into the compositor as its to mangle, just as
it is free to do so for POSIX argv. To support this, we stash argv away
and free the saved copy later so as to not leak.

This works perfectly, except when we never call the compositor at all,
and have no saved array to free. Make sure we free the args in this
case, which can be seen as a leak of any generated args when a test
skips on preflight checks, e.g. drm-smoke when not running in CI.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 3 years ago
parent 2ebdf0a7f3
commit 213195c4db
  1. 5
      tests/weston-test-fixture-compositor.c

@ -93,6 +93,11 @@ prog_args_fini(struct prog_args *p)
{
int i;
/* If our args have never been saved, then we haven't called the
* compositor, but we still need to free the args, not leak them. */
if (!p->saved)
prog_args_save(p);
if (p->saved) {
for (i = 0; i < p->argc; i++)
free(p->saved[i]);

Loading…
Cancel
Save