diff options
author | Sean Gillespie <sean@swgillespie.me> | 2017-04-24 10:44:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 10:44:25 -0700 |
commit | 69d43a0f8cfe095336b286e7bb892fe49c702e30 (patch) | |
tree | f821902c8b213afd95f953f08ae079ba8a824da6 /src/gc/gchandletable.cpp | |
parent | 5c8b9a6870a58e0af250ff822ca395e3fd8268bb (diff) | |
download | coreclr-69d43a0f8cfe095336b286e7bb892fe49c702e30.tar.gz coreclr-69d43a0f8cfe095336b286e7bb892fe49c702e30.tar.bz2 coreclr-69d43a0f8cfe095336b286e7bb892fe49c702e30.zip |
[Local GC] Ensure that handle creation returns null on failure instead of throwing (#11092)
* [Local GC] Ensure that handle creation returns null on failure instead of throwing
* Fix some clang pedantry about jumping past variable initialization
* Throw OOM if initialization of handle store fails
* Perform the handle OOM check in each handle helper
Diffstat (limited to 'src/gc/gchandletable.cpp')
-rw-r--r-- | src/gc/gchandletable.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gc/gchandletable.cpp b/src/gc/gchandletable.cpp index 75646e848a..52fede6299 100644 --- a/src/gc/gchandletable.cpp +++ b/src/gc/gchandletable.cpp @@ -47,8 +47,12 @@ OBJECTHANDLE GCHandleStore::CreateDependentHandle(Object* primary, Object* secon { HHANDLETABLE handletable = _underlyingBucket.pTable[GetCurrentThreadHomeHeapNumber()]; OBJECTHANDLE handle = ::HndCreateHandle(handletable, HNDTYPE_DEPENDENT, ObjectToOBJECTREF(primary)); - ::SetDependentHandleSecondary(handle, ObjectToOBJECTREF(secondary)); + if (!handle) + { + return nullptr; + } + ::SetDependentHandleSecondary(handle, ObjectToOBJECTREF(secondary)); return handle; } |