Fix memory leak in MySQL getBlob function

Direct leak of 768 byte(s) in 2 object(s) allocated from:
    #0 0x4e91ad in operator new(unsigned long)
    #1 0x7f0c54a3bf63 in sql::mysql::MySQL_Prepared_ResultSet::getBlob(unsigned int) const (/usr/lib/x86_64-linux-gnu/libmysqlcppconn.so.7+0x77f63)
This commit is contained in:
Zwelf 2020-10-19 14:00:53 +02:00
parent c04621ea43
commit aa53f28449

View file

@ -306,7 +306,9 @@ int CMysqlConnection::GetBlob(int Col, unsigned char *pBuffer, int BufferSize) c
#if defined(CONF_SQL)
auto Blob = m_pResults->getBlob(Col);
Blob->read((char *)pBuffer, BufferSize);
return Blob->gcount();
int NumRead = Blob->gcount();
delete Blob;
return NumRead;
#else
return 0;
#endif