summaryrefslogtreecommitdiff
path: root/src/debug/di
diff options
context:
space:
mode:
authorOmair Majid <omajid@redhat.com>2019-04-16 01:14:48 -0400
committerJan Kotas <jkotas@microsoft.com>2019-04-15 22:14:48 -0700
commit08318afbeb726eb80f212c70310e5750daec5abf (patch)
treee0095bb8d6e2ee1b0c44caca8ffda1671187a511 /src/debug/di
parent0f838a7c22c6e19748582ced5e03a8e273f63062 (diff)
downloadcoreclr-08318afbeb726eb80f212c70310e5750daec5abf.tar.gz
coreclr-08318afbeb726eb80f212c70310e5750daec5abf.tar.bz2
coreclr-08318afbeb726eb80f212c70310e5750daec5abf.zip
Use NewArrayHolder for array types in src/debug (#24013)
Using a NewHolder with array types means that when the holder is ready to release the memory, it ends up invoking `delete` (instead of `delete[]`) on that array. This is an undefined behaviour. Use NewArrayHolder isntead to fix this.
Diffstat (limited to 'src/debug/di')
-rw-r--r--src/debug/di/process.cpp2
-rw-r--r--src/debug/di/rstype.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/debug/di/process.cpp b/src/debug/di/process.cpp
index 1536f8c918..58c06a0164 100644
--- a/src/debug/di/process.cpp
+++ b/src/debug/di/process.cpp
@@ -9578,7 +9578,7 @@ void Ls_Rs_BaseBuffer::CopyLSDataToRSWorker(ICorDebugDataTarget * pTarget)
ThrowHR(E_INVALIDARG);
}
- NewHolder<BYTE> pData(new BYTE[cbCacheSize]);
+ NewArrayHolder<BYTE> pData(new BYTE[cbCacheSize]);
ULONG32 cbRead;
HRESULT hrRead = pTarget->ReadVirtual(PTR_TO_CORDB_ADDRESS(m_pbLS), pData, cbCacheSize , &cbRead);
diff --git a/src/debug/di/rstype.cpp b/src/debug/di/rstype.cpp
index a85ab0dcc4..8b7c294820 100644
--- a/src/debug/di/rstype.cpp
+++ b/src/debug/di/rstype.cpp
@@ -1549,7 +1549,7 @@ HRESULT CordbType::InitInstantiationTypeHandle(BOOL fForceInit)
{
ThrowHR(E_INVALIDARG);
}
- NewHolder<DebuggerIPCE_BasicTypeData> pArgTypeData(new DebuggerIPCE_BasicTypeData[bufferSize.Value()]);
+ NewArrayHolder<DebuggerIPCE_BasicTypeData> pArgTypeData(new DebuggerIPCE_BasicTypeData[bufferSize.Value()]);
// We will have already called Init on each of the type parameters further above. Now we build a
// list of type information for each type parameter.