From: Mark Yacoub <markyacoub@google.com>
To: igt-dev@lists.freedesktop.org
Cc: louis.chauvet@bootlin.com, Mark Yacoub <markyacoub@google.com>
Subject: [PATCH 2/3] tests/unigraf: Fix DRM master and heap memory leaks in tests
Date: Wed, 15 Jul 2026 15:29:48 -0400 [thread overview]
Message-ID: <20260715192949.1984280-2-markyacoub@google.com> (raw)
In-Reply-To: <20260715192949.1984280-1-markyacoub@google.com>
[Why]
The unigraf_connectivity test allocates connector array buffers dynamically via
kms_wait_for_new_connectors and get_array_diff without freeing them before test
exit, leading to severe heap leaks when executed iteratively. Furthermore, neither
unigraf_connectivity nor unigraf_lt closed drm_fd upon completion, holding the
DRM Master lock open indefinitely. On platforms with a running display compositor
(such as Android's SurfaceFlinger), this leaves the DRM device locked and causes
subsequent graphics tests to fail with resource busy errors.
[How]
Explicitly call free() on already_connected, newly_connected, and diff buffers
at the end of unigraf_connectivity. Add an igt_fixture cleanup block to call
close(drm_fd) when tearing down both unigraf_connectivity and unigraf_lt.
Fixes: c66d08db9177 ("tests/unigraf: Add basic unigraf tests")
Signed-off-by: Mark Yacoub <markyacoub@google.com>
---
tests/unigraf/unigraf_connectivity.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/unigraf/unigraf_connectivity.c b/tests/unigraf/unigraf_connectivity.c
index 927ef2d6f..8ae9a2593 100644
--- a/tests/unigraf/unigraf_connectivity.c
+++ b/tests/unigraf/unigraf_connectivity.c
@@ -134,5 +134,13 @@ int igt_main()
"Invalid connected connector count, expected %d found %d\n",
max(i, 1), diff_len);
}
+
+ free(already_connected);
+ free(newly_connected);
+ free(diff);
+ }
+
+ igt_fixture() {
+ close(drm_fd);
}
}
--
2.55.0.141.g00534a21ce-goog
next prev parent reply other threads:[~2026-07-15 19:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 19:29 [PATCH 1/3] android: Implement lightweight GKeyFile INI string parser in glib shim Mark Yacoub
2026-07-15 19:29 ` Mark Yacoub [this message]
2026-07-15 19:29 ` [PATCH 3/3] tests/unigraf: Enhance link rate support checking and hardware retrain timing Mark Yacoub
2026-07-15 20:27 ` ✓ Xe.CI.BAT: success for series starting with [1/3] android: Implement lightweight GKeyFile INI string parser in glib shim Patchwork
2026-07-15 20:54 ` ✓ i915.CI.BAT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260715192949.1984280-2-markyacoub@google.com \
--to=markyacoub@google.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=louis.chauvet@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox