Abdellazizhammami / arduino

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

memory leak #784

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In

FirmataClass::setFirmwareNameAndVersion(const char *name, byte major, byte 
minor)

is a 

firmwareVersionVector = (byte *) malloc(firmwareVersionCount);

There should be a corresponding free()

in a (to be created) destructor:

FirmataClass::~FirmataClass()
{
    if(firmwareVersionVector)
       free(firmwareVersionVector);
}

The contructor should get a 
firmwareVersionVector = 0;

and / or 
the line could go:

    if(firmwareVersionCount)

- Sebastian Haase

Original issue reported on code.google.com by seb.ha...@gmail.com on 10 Jan 2012 at 8:26