From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] chamelium: Fix analog bridge detection memory leak
Date: Wed, 14 Nov 2018 16:29:18 +0100 [thread overview]
Message-ID: <20181114152918.14692-1-paul.kocialkowski@bootlin.com> (raw)
The connector and EDID blob retrieved when checking for analog bridges
need to be freed before returning from the associated function.
Fixes: f8d6afa67 ("tests/chamelium: Detect analog bridges and handle
EDID accordingly")
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
tests/kms_chamelium.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/kms_chamelium.c b/tests/kms_chamelium.c
index e0e3e3f1..55b346a9 100644
--- a/tests/kms_chamelium.c
+++ b/tests/kms_chamelium.c
@@ -175,8 +175,10 @@ check_analog_bridge(data_t *data, struct chamelium_port *port)
unsigned char *edid;
char edid_vendor[3];
- if (chamelium_port_get_type(port) != DRM_MODE_CONNECTOR_VGA)
+ if (chamelium_port_get_type(port) != DRM_MODE_CONNECTOR_VGA) {
+ drmModeFreeConnector(connector);
return false;
+ }
igt_assert(kmstest_get_property(data->drm_fd, connector->connector_id,
DRM_MODE_OBJECT_CONNECTOR, "EDID", NULL,
@@ -191,14 +193,14 @@ check_analog_bridge(data_t *data, struct chamelium_port *port)
((edid[9] & 0xe0) >> 5)) + '@';
edid_vendor[2] = (edid[9] & 0x1f) + '@';
+ drmModeFreePropertyBlob(edid_blob);
+ drmModeFreeConnector(connector);
+
/* Analog bridges provide their own EDID */
if (edid_vendor[0] != 'I' || edid_vendor[1] != 'G' ||
edid_vendor[0] != 'T')
return true;
- drmModeFreePropertyBlob(edid_blob);
- drmModeFreeConnector(connector);
-
return false;
}
--
2.19.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2018-11-14 15:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-14 15:29 Paul Kocialkowski [this message]
2018-11-14 16:12 ` [igt-dev] ✓ Fi.CI.BAT: success for chamelium: Fix analog bridge detection memory leak Patchwork
2018-11-15 3:04 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-11-21 1:44 ` [igt-dev] [PATCH i-g-t] " Lyude Paul
2018-11-30 14:02 ` Paul Kocialkowski
2018-12-04 0:54 ` Lyude Paul
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=20181114152918.14692-1-paul.kocialkowski@bootlin.com \
--to=paul.kocialkowski@bootlin.com \
--cc=igt-dev@lists.freedesktop.org \
/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