v2.2.9 - add the destructor to resolve issue #135

This commit is contained in:
PaulZC
2022-04-14 11:29:57 +01:00
parent f4cb5d0011
commit 020bd9ea01
3 changed files with 29 additions and 1 deletions
@@ -63,6 +63,31 @@ SFE_UBLOX_GNSS::SFE_UBLOX_GNSS(void)
#endif
}
SFE_UBLOX_GNSS::~SFE_UBLOX_GNSS(void)
{
// Destructor
end(); // Delete all allocated memory - excluding payloadCfg, payloadAuto and spiBuffer
if (payloadCfg != NULL)
{
delete[] payloadCfg; // Created with new[]
payloadCfg = NULL; // Redundant?
}
if (payloadAuto != NULL)
{
delete[] payloadAuto; // Created with new[]
payloadAuto = NULL; // Redundant?
}
if (spiBuffer != NULL)
{
delete[] spiBuffer; // Created with new[]
spiBuffer = NULL; // Redundant?
}
}
// Stop all automatic message processing. Free all used RAM
void SFE_UBLOX_GNSS::end(void)
{
@@ -70,6 +95,8 @@ void SFE_UBLOX_GNSS::end(void)
// Note: payloadAuto is not deleted
// Note: spiBuffer is not deleted
if (ubxFileBuffer != NULL) // Check if RAM has been allocated for the file buffer
{
#ifndef SFE_UBLOX_REDUCED_PROG_MEM