#3 closed defect (wontfix)
Does not detect second similar leak place
| Reported by: | kimmov | Owned by: | noone |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Other | Version: | |
| Keywords: | Cc: | kimmov@…, sigra |
Description (last modified by )
This kind of pattern:
Cls * p = new Cls; [...] if (condition) return; if (condition2) return; delete p;
rightfully gives error "Memory leak: p". But it points only second return line in the pattern. The first return line is leak as well.
Noticed this with WinMerge 2.13.1 codebase. ChildFrm.cpp (not from 2.13.1 but current SVN) also attached.
Outputs error:
[ChildFrm.cpp:202]: Memory leak: pWnd
Should also output:
[ChildFrm.cpp:195]: Memory leak: pWnd
Attachments (1)
Change History (6)
by , 18 years ago
| Attachment: | ChildFrm.cpp added |
|---|
comment:1 by , 18 years ago
Forgot to mention that must run cppcheck with --all switch to see the error. And cppcheck version is current SVN (r992).
comment:2 by , 18 years ago
| Description: | modified (diff) |
|---|
comment:3 by , 18 years ago
I think this is because the simplifycode will reduce multiple "if return ; if return ;" into a single "if return".
If so.. fixing this memory leak will cause cppcheck to detect the other memory leak and report that.
If all this is true then it's "ok" behaviour.
comment:4 by , 18 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
this is "ok" behaviour as discussed above
comment:5 by , 17 years ago
| Cc: | added |
|---|
ChildFrm.cpp from WinMerge SVN