I recently found a false-negative bug in the checker for unsafeClassCanLeak that was caused by the fact that placement new was used to allocate the member that should have caused the warning. It could be that there are more checkers that look for uses of new that wouldn't match a placement new, do you know how likely it is that more checkers are affected by this? Would it be worth the effort to find and fix them all?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I believe a related problem is that basically we do not handle when
more than one pointer points at the allocated memory.. if both
pointers can free the memory. No leak is reported here:
void f(){
void *p = malloc(10);
void *p2 = p;//<- leaks checking of "p" bails out here
}
We should be more intelligent in such cases.
Would it be worth the effort to find and fix them all?
I believe it would be interesting with a few tickets for a few obvious
leaks. However, to be honest, I am not sure when this can be fixed:
memory leaks checking is not getting a lot of attention. :-(
I recently found a false-negative bug in the checker for unsafeClassCanLeak that was caused by the fact that placement new was used to allocate the member that should have caused the warning. It could be that there are more checkers that look for uses of new that wouldn't match a placement new, do you know how likely it is that more checkers are affected by this? Would it be worth the effort to find and fix them all?
I recently found a false-negative bug in the checker for unsafeClassCanLeak that was caused by the fact that placement new was used to allocate the member that should have caused the warning. It could be that there are more checkers that look for uses of new that wouldn't match a placement new, do you know how likely it is that more checkers are affected by this? Would it be worth the effort to find and fix them all?
hmm.. we need to be careful about placement new
I have the feeling we've had 2-3 false positive reports with that.
Here is one ticket:
https://trac.cppcheck.net/ticket/7163
I believe a related problem is that basically we do not handle when
more than one pointer points at the allocated memory.. if both
pointers can free the memory. No leak is reported here:
We should be more intelligent in such cases.
I believe it would be interesting with a few tickets for a few obvious
leaks. However, to be honest, I am not sure when this can be fixed:
memory leaks checking is not getting a lot of attention. :-(
Den fre 28 juni 2019 kl 19:15 skrev Nick Ridgway
rebnridgway@users.sourceforge.net: