bilwis / RMD

RMD
0 stars 0 forks source link

Possible memory leak with char[] in Part-derived classes #4

Closed bilwis closed 10 years ago

bilwis commented 10 years ago

During construction of Part and its derived classes, strings are given as parameters. These are copied by allocating memory and copying the string into it. The dynamically allocated char arrays are referenced by a header-declared pointer variable, but (presumably) not automatically freed on destruction. In order to ensure memory integrity, all calls to malloc() in the constructor should be matched by calls to free() in the destructor.

bilwis commented 10 years ago

Also instead of malloc() anf free(), new [] and delete should be used!