c++ - CppCheck does not detect memory leak -


have following code, cppcheck(1.68) detects "style" error.

abstracttelegram *telegramfactory::creategetwigwagparametertelegram(byte     address_i, byte subaddress_i, byte tag_i) {    signdatawigwag *pwigwag = new signdatawigwag();     return new sendtelegram(subaddress_i, tag_i, telegram::get_wig_wag,null,0); } 

output:

variable 'pwigwag' assigned value never used. variable 'pwigwag' assigned value never used. 

any options tune?

i cppcheck developer.

actually.. can't see there memory leak in code.

there classes has automatic memory management.

imagine example signdatawigwag constructor has such code:

signdatawigwag::signdatawigwag() {     instances.push_back(this); } 

then can deleted later using instance:

void deleteallinstances() {     while (!instances.empty()) {         delete instances.back();         instances.pop_back();     } } 

this not unusual. popular class libraries has lots of classes kind of memory management manual delete not needed..


Comments

Popular posts from this blog

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -