[haiku-commits] Re: haiku: hrev47664 - src/kits/tracker headers/private/tracker

  • From: pulkomandy <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 11 Aug 2014 07:50:39 +0200

> > I don't know how many time we will have to repeat this: no, by default
> > it doesn't. You need to explicitly enable "owning" mode in the
> > constructor. Most issues with BObjectList in Coverity are thus false
> > positive because we almost never use that flag.
> 
> That was my guess for the cause, the CID in question should provide an
> explanation of the error for each case. If the list wasn't owning then
> the pointer wouldn't get deleted, and there would be no CID for use
> after free, correct?

WRONG!

Coverity is not perfect, and object ownership in BObjectList is
something it doesn't detect properly. I hope you didn't blindly apply
Coverity advice everywhere like this, as there are several cases where
its advice is not right. Fixing Coverity issues needs first
understanding the code and making sure that:
- The problem can happen at all
- The solution suggested by Coverity is correct (for example in the
  BObjectList case, the next scan will report that there is a possible
  double free when the list is not owning)

If you don't follow these rules, you probably introduced as much bugs as
you removed. Possibly more important ones, as a double free will crash
Tracker, whereas a memory leak will not. I will certainly not upgrade my
install until all this has been very closely reviewed...

-- 
Adrien.

Other related posts: