Whilst looking through the code I noticed in FileIO/JouleDevice.cpp that the
result char array is not deleted on exit, the returned QString copies
result on return and the
result memory is leaked?
static QString
cEscape(char *buf, int len)
{
char *result = new char[4 * len + 1]; char *tmp = result;
for (int i = 0; i < len; ++i) {
if (buf[i] == '"')
tmp += sprintf(tmp, "\\\"");
else if (isprint(buf[i]))
*(tmp++) = buf[i];
else
tmp += sprintf(tmp, "\\x%02x", 0xff & (unsigned) buf[i]);
}
return result;
}
Also later in
FileIO/JouleDevice.cpp in function JoulePacket::Read() the creation of char arrays is made dependent on platform Q_CC_MSVC, I guess this is due to Windows having a smaller default stack than Linux ?