Kaydet (Commit) e1e2b47c authored tarafından Julien Nabet's avatar Julien Nabet Kaydeden (comit) Andras Timar

cppcheck: Mismatching allocation and deallocation

+ Typo: excecptionTypeSizeArray->exceptionTypeSizeArray

Cherry-picked from 81d62c5f

Change-Id: I6fac3bea1eba094e87717d20a08ec7cf6151e2df
Reviewed-on: https://gerrit.libreoffice.org/18527Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst ca062ab3
...@@ -609,8 +609,8 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw () ...@@ -609,8 +609,8 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
// 2.Pass: Get the total needed memory for class ExceptionType // 2.Pass: Get the total needed memory for class ExceptionType
// (with embedded type_info) and keep the sizes for each instance // (with embedded type_info) and keep the sizes for each instance
// is stored in alloced int array // is stored in allocated int array
int *excecptionTypeSizeArray = new int[nLen]; int *exceptionTypeSizeArray = new int[nLen];
nLen = 0; nLen = 0;
for (pCompTD = (typelib_CompoundTypeDescription*)pTD; for (pCompTD = (typelib_CompoundTypeDescription*)pTD;
...@@ -625,14 +625,14 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw () ...@@ -625,14 +625,14 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
n++; n++;
typeInfoLen = n*4; typeInfoLen = n*4;
} }
excecptionTypeSizeArray[nLen++] = typeInfoLen + sizeof(ExceptionType); exceptionTypeSizeArray[nLen++] = typeInfoLen + sizeof(ExceptionType);
} }
// Total ExceptionType related mem // Total ExceptionType related mem
int excTypeAddLen = 0; int excTypeAddLen = 0;
for (int i = 0; i < nLen; i++) for (int i = 0; i < nLen; i++)
{ {
excTypeAddLen += excecptionTypeSizeArray[i]; excTypeAddLen += exceptionTypeSizeArray[i];
} }
// Allocate mem for code and all dynamic data in one chunk to guarantee // Allocate mem for code and all dynamic data in one chunk to guarantee
...@@ -684,7 +684,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw () ...@@ -684,7 +684,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
// Next trampoline entry offset // Next trampoline entry offset
pCodeOffset += codeSnippetSize; pCodeOffset += codeSnippetSize;
// Next ExceptionType placement offset // Next ExceptionType placement offset
etMemOffset += excecptionTypeSizeArray[nPos - 1]; etMemOffset += exceptionTypeSizeArray[nPos - 1];
// Keep offset of addresses of ET for D-Tor call in ~RaiseInfo // Keep offset of addresses of ET for D-Tor call in ~RaiseInfo
types[nPos++] types[nPos++]
...@@ -694,7 +694,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw () ...@@ -694,7 +694,7 @@ RaiseInfo::RaiseInfo(typelib_TypeDescription * pTD)throw ()
assert(etMem + etMemOffset == pCode + totalSize); assert(etMem + etMemOffset == pCode + totalSize);
// remove array // remove array
delete excecptionTypeSizeArray; delete[] exceptionTypeSizeArray;
} }
RaiseInfo::~RaiseInfo() throw () RaiseInfo::~RaiseInfo() throw ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment