All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lisovskiy, Stanislav" <stanislav.lisovskiy@intel.com>
To: Mika Kahola <mika.kahola@intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t v3 2/2] tests/kms_concurrent: Plug possible memory leaks
Date: Fri, 27 Mar 2020 10:01:42 +0200	[thread overview]
Message-ID: <20200327080142.GA26731@intel.com> (raw)
In-Reply-To: <20200326135322.9958-3-mika.kahola@intel.com>

On Thu, Mar 26, 2020 at 03:53:22PM +0200, Mika Kahola wrote:
> Free dynamically allocated memory that has a potential
> to leak memory.
> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  tests/kms_concurrent.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

TBH dynamically allocating memory here seems to be overkill
anyway. We already know for sure that max planes that we are going
to have is no more than 8, We could just set limit of max planes to
lets say even 10 and just do all this stuff in stack, thus avoiding
those issues.

Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>

> diff --git a/tests/kms_concurrent.c b/tests/kms_concurrent.c
> index 1a7c12fc..1403e990 100644
> --- a/tests/kms_concurrent.c
> +++ b/tests/kms_concurrent.c
> @@ -193,6 +193,10 @@ prepare_planes(data_t *data, enum pipe pipe, int max_planes,
>  				    max_planes, output);
>  
>  	igt_plane_set_fb(data->plane[primary->index], &data->fb[primary->index]);
> +
> +	free(x);
> +	free(y);
> +	free(size);
>  }
>  
>  static int test_bandwidth(data_t *data, enum pipe pipe, igt_output_t *output)
> @@ -228,6 +232,10 @@ test_plane_position_with_output(data_t *data, enum pipe pipe, int max_planes,
>  	while (i < iterations || loop_forever) {
>  		prepare_planes(data, pipe, max_planes, output);
>  		igt_display_commit2(&data->display, COMMIT_ATOMIC);
> +
> +		for (int c = 0; c < max_planes; c++)
> +			igt_remove_fb(data->drm_fd, &data->fb[c]);
> +
>  		i++;
>  	}
>  }
> -- 
> 2.20.1
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-03-27  8:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 13:53 [igt-dev] [PATCH i-g-t v3 0/2] tests/kms_concurrent: Test maximum number of planes supported by the platform Mika Kahola
2020-03-26 13:53 ` [igt-dev] [PATCH i-g-t v3 1/2] " Mika Kahola
2020-03-27  8:05   ` Lisovskiy, Stanislav
2020-03-26 13:53 ` [igt-dev] [PATCH i-g-t v3 2/2] tests/kms_concurrent: Plug possible memory leaks Mika Kahola
2020-03-27  8:01   ` Lisovskiy, Stanislav [this message]
2020-03-27 10:05     ` Kahola, Mika
2020-03-26 14:40 ` [igt-dev] [PATCH i-g-t v3 0/2] tests/kms_concurrent: Test maximum number of planes supported by the platform Juha-Pekka Heikkila
2020-03-26 17:09 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_concurrent: Test maximum number of planes supported by the platform (rev3) Patchwork
2020-03-27 10:05 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-03-27 10:24   ` Petri Latvala
2020-03-27 11:45     ` Kahola, Mika
2020-03-27 12:34       ` Petri Latvala
2020-03-27 12:35         ` Kahola, Mika
2020-03-27 12:36         ` Kahola, Mika
2020-03-27 13:17         ` Kahola, Mika
2020-03-27 12:07 ` [igt-dev] ✗ Fi.CI.BUILD: failure for tests/kms_concurrent: Test maximum number of planes supported by the platform (rev4) 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=20200327080142.GA26731@intel.com \
    --to=stanislav.lisovskiy@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=mika.kahola@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.