[haiku-development] Re: object on the hype, using it as parameter and then use delete

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 12 Sep 2008 14:23:03 +0200

On 2008-09-12 at 13:56:21 [+0200], Fredrik Modéen <fredrik@xxxxxxxxx> wrote:
> I'm going to show my lack of knowledge here :)
> 
> Coverty reports a RESOURCE_LEAK (CID 868)
> in filetypes/IconView.cpp.
> 
> If i'm going to follow Coverty suggestion I would put a delete(mini); at
> the end of MessageReceived, but wouldn't that destroy a object that
> perhaps are in use?

Nope, BAppFileInfo::SetIconForType() does not take over ownership of the 
supplied bitmap. It only writes it to the file's resources/attributes. So 
"mini" is indeed leaked.

CU, Ingo

Other related posts: