From b55fd2b010785b34c6f42f7333d51ed8ab21c772 Mon Sep 17 00:00:00 2001 From: Valient Gough Date: Mon, 17 Jun 2013 03:33:45 +0000 Subject: [PATCH] fix MemoryPool build with openssl git-svn-id: http://encfs.googlecode.com/svn/trunk@101 db9cf616-1c43-0410-9cb8-a902689de0d6 --- cipher/MemoryPool.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cipher/MemoryPool.cpp b/cipher/MemoryPool.cpp index 57da524..0b5e14d 100644 --- a/cipher/MemoryPool.cpp +++ b/cipher/MemoryPool.cpp @@ -75,7 +75,7 @@ static byte *allocBlock(int size) { } unsigned char cleanse_ctr = 0; -static void cleanBlock(byte *data, int len) { +static void freeBlock(byte *data, int len) { byte *p = data; size_t loop = len, ctr = cleanse_ctr; while(loop--) @@ -88,6 +88,7 @@ static void cleanBlock(byte *data, int len) { if(p) ctr += (63 + (size_t)p); cleanse_ctr = (unsigned char)ctr; + delete[] data; } #endif @@ -101,8 +102,7 @@ void MemBlock::allocate(int size) MemBlock::~MemBlock() { - cleanBlock(data, size); - delete[] data; + freeBlock(data, size); } #ifdef WITH_BOTAN @@ -147,8 +147,7 @@ SecureMem::~SecureMem() { if (size_) { - cleanBlock(data_, size_); - delete[] data_; + freeBlock(data_, size_); munlock(data_, size_); data_ = NULL;