eraj007 / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

checked to source with static-code analyis tool and found a few memory leaks #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.check the source of arduino-0015 with the static code analysis tool
cppcheck (http://cppcheck.wiki.sourceforge.net/)

What is the expected output? no errors expexted.
What do you see instead?
the output is as followed:

arduino-0015$ cppcheck -a -q -j2 -f -v .
[./hardware/libraries/Firmata/Firmata.h:106]: (all) Memory leak:
FirmataClass::firmwareVersionVector
[./hardware/libraries/Matrix/Matrix.h:34]: (all) Memory leak: Matrix::_buffer
[./hardware/libraries/Sprite/Sprite.h:36]: (all) Memory leak: Sprite::_buffer
[./hardware/libraries/Wire/Wire.h:30]: (all) Memory leak: TwoWire::rxBuffer
[./hardware/libraries/Wire/Wire.h:35]: (all) Memory leak: TwoWire::txBuffer

What version of the Arduino software are you using? arduino-0015
On what operating system? Ubuntu Linux (Jaunty 9.04) 
Which Arduino board are you using? ---

Please provide any additional information below.

Original issue reported on code.google.com by ettl.mar...@gmail.com on 22 May 2009 at 11:43

GoogleCodeExporter commented 9 years ago
I think there is a misunderstanding here.   
The calls to calloc() are only called once when driver is initialized...   
there is no close() method, so cppcheck is 
going to report a leak...  In reality, for the arduino applications there is no 
leak occurring..  

This might become an issue if a later spin of the libraries need to handle 
multiple initializations of the same 
device for different tasks...  that really doesn't apply in the current context.

Original comment by Han.Sont...@gmail.com on 1 Jun 2009 at 6:18

GoogleCodeExporter commented 9 years ago

Original comment by dmel...@gmail.com on 15 Jun 2009 at 8:03