On FIT SDK 20.66.00, I have noticed that adding a new record with developer fields to FIT file can cause double memory free issue.
DeveloperFieldDefinition class contain raw pointers, but does not define custom copy assignment operator to avoid memberwise copy of pointers.
This leads to double free of the same pointer address in void Encode::Write( const MesgDefinition& mesgDef ) function when existing message definition is destructed at lastMesgDefinition[mesgDef.GetLocalNum()] = mesgDef line.
void Encode::Write( const MesgDefinition& mesgDef )
{
if ( !file )
return;
if ( !validator.ValidateMesgDefn( mesgDef ) )
return;
dataSize += mesgDef.Write( *file );
lastMesgDefinition[mesgDef.GetLocalNum()] = mesgDef;
}
Attaching valgrind logs which provide detailed explanation of this issue.