From: Omar Ramirez Luna <omar.ramirez@ti.com>
To: Ameya Palande <ameya.palande@nokia.com>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"omap.ramirez@ti.com" <omap.ramirez@ti.com>,
"Menon, Nishanth" <nm@ti.com>,
"Chitriki Rudramuni, Deepak" <deepak.chitriki@ti.com>
Subject: Re: [PATCH] DSPBRIDGE: Fix memory leak in PROC_AutoStart()
Date: Fri, 5 Feb 2010 18:58:50 -0600 [thread overview]
Message-ID: <4B6CBECA.4080603@ti.com> (raw)
In-Reply-To: <1265045493.1997.26.camel@sanganak>
Hi,
On 2/1/2010 11:31 AM, Ameya Palande wrote:
> Hi Omar,
>
> On Mon, 2010-01-25 at 20:21 +0100, ext Omar Ramirez Luna wrote:
>> Hi,
>>
>> On 1/21/2010 7:03 AM, Ameya Palande wrote:
>>> Signed-off-by: Ameya Palande<ameya.palande@nokia.com>
>>> ---
>>> drivers/dsp/bridge/rmgr/proc.c | 4 ++++
>>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/dsp/bridge/rmgr/proc.c b/drivers/dsp/bridge/rmgr/proc.c
>>> index a75b64a..91ab64f 100644
>>> --- a/drivers/dsp/bridge/rmgr/proc.c
>>> +++ b/drivers/dsp/bridge/rmgr/proc.c
>>> @@ -512,6 +512,10 @@ DSP_STATUS PROC_AutoStart(struct CFG_DEVNODE *hDevNode,
>>> "No Exec file found \n");
>>> }
>>> func_cont:
>>> + if (hProcObject->g_pszLastCoff) {
>>> + MEM_Free(hProcObject->g_pszLastCoff);
>>> + hProcObject->g_pszLastCoff = NULL;
>>> + }
>>
>> Wouldn't be better to keep this inside PROC_Load in case of error?
>
> PROC_Load allocates the memory to hProcObject->g_pszLastCoff which gets
> freed in PROC_Detach. But PROC_AutoStart is a special case. It creates a
> dummy ProcObject and after it is done with it, it frees it. And there it
> leaks the memory. So IMO this is the correct place.
Ok, agree.
>
>> Also MEM_Free checks for NULL.
>
> Agreed! I will send a V2 of the patch with without the check.
>
>>
>>> MEM_FreeObject(hProcObject);
>>> func_end:
>>> GT_1trace(PROC_DebugMask, GT_ENTER,
>>
>> Regards,
>>
>> Omar
>
> Thanks for your review!
>
> Cheers,
> Ameya.
>
- omar
next prev parent reply other threads:[~2010-02-06 0:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-21 13:03 [PATCH] DSPBRIDGE: Fix memory leak in PROC_AutoStart() Ameya Palande
2010-01-25 19:21 ` Omar Ramirez Luna
2010-02-01 17:31 ` Ameya Palande
2010-02-01 17:36 ` [PATCHv2] " Ameya Palande
2010-02-06 1:57 ` Omar Ramirez Luna
2010-02-06 0:58 ` Omar Ramirez Luna [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-09-02 18:59 [PATCH] " Ameya Palande
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=4B6CBECA.4080603@ti.com \
--to=omar.ramirez@ti.com \
--cc=ameya.palande@nokia.com \
--cc=deepak.chitriki@ti.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=omap.ramirez@ti.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