From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Huihui Huang <hhhuang@smu.edu.sg>
Cc: Hans de Goede <hansg@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Andy Shevchenko <andy@kernel.org>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-media@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: media: atomisp: fix memory leak of dvs2_coeff
Date: Thu, 16 Apr 2026 21:32:56 +0300 [thread overview]
Message-ID: <aeErWPk-gs-iCAN6@ashevche-desk.local> (raw)
In-Reply-To: <20260416131626.2544105-1-hhhuang@smu.edu.sg>
On Thu, Apr 16, 2026 at 09:16:26PM +0800, Huihui Huang wrote:
> There is a memory leak in
> drivers/staging/media/atomisp/pci/atomisp_compat_css20.c.
>
> In atomisp_alloc_dis_coef_buf(), dvs2_coeff is allocated by
> ia_css_dvs2_coefficients_allocate() and stored in
> asd->params.css_param.dvs2_coeff. If the subsequent
> ia_css_dvs2_statistics_allocate() for dvs_stat fails, the function
> returns -ENOMEM without freeing the previously allocated dvs2_coeff.
> Add the missing ia_css_dvs2_coefficients_free() call and set the
> pointer to NULL before returning on the error path.
Why do we need this?
...
> asd->params.dvs_stat = ia_css_dvs2_statistics_allocate(dvs_grid);
> - if (!asd->params.dvs_stat)
> + if (!asd->params.dvs_stat) {
> + ia_css_dvs2_coefficients_free(asd->params.css_param.dvs2_coeff);
> + asd->params.css_param.dvs2_coeff = NULL;
Actually same Q here: Do we need this NULLification?
> return -ENOMEM;
> + }
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-04-16 18:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 6:41 [PATCH] staging: media: atomisp: fix memory leak of dvs2_coeff Huihui Huang
2026-04-16 8:08 ` Andy Shevchenko
2026-04-16 13:16 ` [PATCH v2] " Huihui Huang
2026-04-16 18:32 ` Andy Shevchenko [this message]
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=aeErWPk-gs-iCAN6@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=hhhuang@smu.edu.sg \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.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