Opened 17 years ago
Last modified 21 months ago
#892 new enhancement
Improve memory leak detection for multidimensional array
| Reported by: | lefreut | Owned by: | noone |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | Improve check | Version: | |
| Keywords: | memleak | Cc: | lefreut |
Description (last modified by )
Hello,
cppcheck does not find the memory leak in this code:
int main()
{
int ** foo = new int*[2];
foo[0] = new int;
delete [] foo;
return 0;
}
Change History (7)
comment:1 by , 17 years ago
| Milestone: | 1.39 |
|---|
comment:2 by , 17 years ago
| Summary: | Improve memory leak detection → Improve memory leak detection '{ int **p = new char[100]; }' |
|---|
comment:3 by , 15 years ago
| Priority: | → Normal |
|---|---|
| Summary: | Improve memory leak detection '{ int **p = new char[100]; }' → Improve memory leak detection '{ int **p = new int*[2]; }' |
comment:4 by , 6 years ago
comment:5 by , 4 years ago
| Keywords: | memleak added |
|---|---|
| Summary: | Improve memory leak detection '{ int **p = new int*[2]; }' → Improve memory leak detection for multidimensional array |
No meleak warning with malloc either:
int main() {
int** foo = (int**)malloc(2 * sizeof(int*));
foo[0] = (int*)malloc(sizeof(int));
free(foo);
}
Note:
See TracTickets
for help on using tickets.
Looks like a duplicate/variation of #114.