public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 5/6] tests/kms_flip: don't leak the connector_config struct
Date: Mon, 30 Dec 2013 13:56:52 -0200	[thread overview]
Message-ID: <1388419013-17016-5-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1388419013-17016-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

... in case we can't find a compatible mode. We already have
config[0], we can't return without freeing it first.

Caught by Valgrind.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 tests/kms_flip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 78e179e..c43a26f 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -954,8 +954,10 @@ static void connector_find_compatible_mode(int crtc_idx0, int crtc_idx1,
 		return;
 
 	if (kmstest_get_connector_config(drm_fd, o->_connector[1],
-					 1 << crtc_idx1, &config[1]) < 0)
+					 1 << crtc_idx1, &config[1]) < 0) {
+		kmstest_free_connector_config(&config[0]);
 		return;
+	}
 
 	mode[0] = &config[0].default_mode;
 	mode[1] = &config[1].default_mode;
-- 
1.8.3.1

  parent reply	other threads:[~2013-12-30 15:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-30 15:56 [PATCH 1/6] igt_kms: don't leak the mmap used for cairo Paulo Zanoni
2013-12-30 15:56 ` [PATCH 2/6] drmtest: don't leak memory when parsing the arguments Paulo Zanoni
2013-12-30 15:56 ` [PATCH 3/6] tests/kms_flip: don't leak the connector when setting DPMS Paulo Zanoni
2013-12-30 15:56 ` [PATCH 4/6] tests/kms_flip: don't leak the CRTC Paulo Zanoni
2013-12-30 15:56 ` Paulo Zanoni [this message]
2013-12-30 15:56 ` [PATCH 6/6] tests/kms_flip: free the test_output struct when counting modes Paulo Zanoni
2014-01-07  7:16   ` Daniel Vetter
2013-12-30 17:40 ` [PATCH 1/6] igt_kms: don't leak the mmap used for cairo Chris Wilson
2013-12-30 17:53   ` Paulo Zanoni
2013-12-30 18:16     ` Chris Wilson
2013-12-31 12:32       ` Chris Wilson
2014-01-02 16:44         ` Paulo Zanoni

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=1388419013-17016-5-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.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