fix MemoryPool build with openssl

git-svn-id: http://encfs.googlecode.com/svn/trunk@101 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
Valient Gough 2013-06-17 03:33:45 +00:00
parent 2d90473d09
commit b55fd2b010

View File

@ -75,7 +75,7 @@ static byte *allocBlock(int size) {
} }
unsigned char cleanse_ctr = 0; unsigned char cleanse_ctr = 0;
static void cleanBlock(byte *data, int len) { static void freeBlock(byte *data, int len) {
byte *p = data; byte *p = data;
size_t loop = len, ctr = cleanse_ctr; size_t loop = len, ctr = cleanse_ctr;
while(loop--) while(loop--)
@ -88,6 +88,7 @@ static void cleanBlock(byte *data, int len) {
if(p) if(p)
ctr += (63 + (size_t)p); ctr += (63 + (size_t)p);
cleanse_ctr = (unsigned char)ctr; cleanse_ctr = (unsigned char)ctr;
delete[] data;
} }
#endif #endif
@ -101,8 +102,7 @@ void MemBlock::allocate(int size)
MemBlock::~MemBlock() MemBlock::~MemBlock()
{ {
cleanBlock(data, size); freeBlock(data, size);
delete[] data;
} }
#ifdef WITH_BOTAN #ifdef WITH_BOTAN
@ -147,8 +147,7 @@ SecureMem::~SecureMem()
{ {
if (size_) if (size_)
{ {
cleanBlock(data_, size_); freeBlock(data_, size_);
delete[] data_;
munlock(data_, size_); munlock(data_, size_);
data_ = NULL; data_ = NULL;