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 kidkat)

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 hyd_danmar, 17 years ago

Milestone: 1.39

comment:2 by hyd_danmar, 17 years ago

Summary: Improve memory leak detectionImprove memory leak detection '{ int **p = new char[100]; }'

comment:3 by neuschaefer, 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 kidkat, 6 years ago

Looks like a duplicate/variation of #114.

comment:5 by chrchr, 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);
}

comment:6 by chrchr, 4 years ago

Related: #422

comment:7 by kidkat, 21 months ago

Description: modified (diff)

Related/duplicate: #2565

Note: See TracTickets for help on using tickets.