mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-01 09:24:55 +02:00
SF [2019857] Memory leak in Data::ODBC Extractor (fixed using Poco::Buffer)
This commit is contained in:
parent
2589797359
commit
d4f2be3fd2
@ -39,6 +39,7 @@
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/BLOB.h"
|
||||
#include "Poco/Buffer.h"
|
||||
#include "Poco/Exception.h"
|
||||
|
||||
|
||||
@ -368,10 +369,8 @@ bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val
|
||||
std::size_t totalSize = 0;
|
||||
|
||||
SQLLEN len;
|
||||
char* pChar = 0;
|
||||
try
|
||||
{
|
||||
pChar = new char[CHUNK_SIZE];
|
||||
Poco::Buffer<char> apChar(CHUNK_SIZE);
|
||||
char* pChar = apChar.begin();
|
||||
SQLRETURN rc = 0;
|
||||
|
||||
val.clear();
|
||||
@ -412,14 +411,7 @@ bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val
|
||||
throw DataException(format(FLD_SIZE_EXCEEDED_FMT, fetchedSize, maxSize));
|
||||
}while (true);
|
||||
|
||||
delete[] pChar;
|
||||
return true;
|
||||
|
||||
} catch (...)
|
||||
{
|
||||
delete[] pChar;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -433,10 +425,8 @@ bool Extractor::extractManualImpl<Poco::Data::BLOB>(std::size_t pos,
|
||||
std::size_t totalSize = 0;
|
||||
|
||||
SQLLEN len;
|
||||
char* pChar = 0;
|
||||
try
|
||||
{
|
||||
pChar = new char[CHUNK_SIZE];
|
||||
Poco::Buffer<char> apChar(CHUNK_SIZE);
|
||||
char* pChar = apChar.begin();
|
||||
SQLRETURN rc = 0;
|
||||
|
||||
val.clear();
|
||||
@ -476,14 +466,7 @@ bool Extractor::extractManualImpl<Poco::Data::BLOB>(std::size_t pos,
|
||||
|
||||
}while (true);
|
||||
|
||||
delete[] pChar;
|
||||
return true;
|
||||
|
||||
} catch (...)
|
||||
{
|
||||
delete[] pChar;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user