summaryrefslogtreecommitdiff
path: root/src/vm/comthreadpool.cpp
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2017-10-16 17:36:09 -0400
committerStephen Toub <stoub@microsoft.com>2017-10-16 17:36:09 -0400
commitbe15337d533d9cc8338c731b4af2788de8e23791 (patch)
treeaadb037f651f776ad8714b69413e612d6f30b6ae /src/vm/comthreadpool.cpp
parent6f4dec5e4ec0297f68f1f5821d9fbfdb858ddcd4 (diff)
downloadcoreclr-be15337d533d9cc8338c731b4af2788de8e23791.tar.gz
coreclr-be15337d533d9cc8338c731b4af2788de8e23791.tar.bz2
coreclr-be15337d533d9cc8338c731b4af2788de8e23791.zip
Address PR feedback
Diffstat (limited to 'src/vm/comthreadpool.cpp')
-rw-r--r--src/vm/comthreadpool.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/vm/comthreadpool.cpp b/src/vm/comthreadpool.cpp
index 08c056b1fe..6ab6b60013 100644
--- a/src/vm/comthreadpool.cpp
+++ b/src/vm/comthreadpool.cpp
@@ -867,14 +867,10 @@ HANDLE QCALLTYPE AppDomainTimerNative::CreateAppDomainTimer(INT32 dueTime, INT32
AppDomain* pAppDomain = GetThread()->GetDomain();
ADID adid = pAppDomain->GetId();
- ThreadpoolMgr::TimerInfoContext* timerContext = new (nothrow) ThreadpoolMgr::TimerInfoContext();
- if (timerContext == NULL)
- {
- COMPlusThrowOM();
- }
-
+ ThreadpoolMgr::TimerInfoContext* timerContext = new ThreadpoolMgr::TimerInfoContext();
timerContext->AppDomainId = adid;
timerContext->TimerId = timerId;
+ NewHolder<ThreadpoolMgr::TimerInfoContext> timerContextHolder(timerContext);
BOOL res = ThreadpoolMgr::CreateTimerQueueTimer(
&hTimer,
@@ -886,13 +882,15 @@ HANDLE QCALLTYPE AppDomainTimerNative::CreateAppDomainTimer(INT32 dueTime, INT32
if (!res)
{
- delete timerContext;
-
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
COMPlusThrow(kNotSupportedException);
else
COMPlusThrowWin32();
}
+ else
+ {
+ timerContextHolder.SuppressRelease();
+ }
END_QCALL;
return hTimer;