From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paulo Zanoni Subject: [PATCH 6/6] tests/kms_flip: free the test_output struct when counting modes Date: Mon, 30 Dec 2013 13:56:53 -0200 Message-ID: <1388419013-17016-6-git-send-email-przanoni@gmail.com> References: <1388419013-17016-1-git-send-email-przanoni@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-qa0-f48.google.com (mail-qa0-f48.google.com [209.85.216.48]) by gabe.freedesktop.org (Postfix) with ESMTP id A4B57FA230 for ; Mon, 30 Dec 2013 07:57:17 -0800 (PST) Received: by mail-qa0-f48.google.com with SMTP id w5so10851697qac.14 for ; Mon, 30 Dec 2013 07:57:17 -0800 (PST) In-Reply-To: <1388419013-17016-1-git-send-email-przanoni@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org From: Paulo Zanoni 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 --- 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