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 6/6] tests/kms_flip: free the test_output struct when counting modes
Date: Mon, 30 Dec 2013 13:56:53 -0200	[thread overview]
Message-ID: <1388419013-17016-6-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>

Looks like we have to do a lot of work just to count the number of
modes...

Caught by Valgrind.

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

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index c43a26f..7e5e355 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1129,6 +1129,16 @@ static unsigned event_loop(struct test_output *o, unsigned duration_ms)
 	return end - start;
 }
 
+static void free_test_output(struct test_output *o)
+{
+	int i;
+
+	for (i = 0; i < o->count; i++) {
+		drmModeFreeEncoder(o->kencoder[i]);
+		drmModeFreeConnector(o->kconnector[i]);
+	}
+}
+
 static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
 				 int crtc_count, int duration_ms)
 {
@@ -1231,10 +1241,7 @@ out:
 
 	last_connector = NULL;
 
-	for (i = 0; i < o->count; i++) {
-		drmModeFreeEncoder(o->kencoder[i]);
-		drmModeFreeConnector(o->kconnector[i]);
-	}
+	free_test_output(o);
 }
 
 static int run_test(int duration, int flags)
@@ -1261,6 +1268,7 @@ static int run_test(int duration, int flags)
 			if (o.mode_valid)
 				modes++;
 
+			free_test_output(&o);
 		}
 	}
 
@@ -1318,6 +1326,7 @@ static int run_pair(int duration, int flags)
 					if (o.mode_valid)
 						modes++;
 
+					free_test_output(&o);
 				}
 			}
 		}
-- 
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 ` [PATCH 5/6] tests/kms_flip: don't leak the connector_config struct Paulo Zanoni
2013-12-30 15:56 ` Paulo Zanoni [this message]
2014-01-07  7:16   ` [PATCH 6/6] tests/kms_flip: free the test_output struct when counting modes 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-6-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