Skip to content

Commit 5859e3c

Browse files
committed
fix crash
1 parent 56ed0b8 commit 5859e3c

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

source/loader/layers/sanitizer/asan_interceptor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ SanitizerInterceptor::~SanitizerInterceptor() {
186186
DestroyShadowMemoryOnPVC();
187187
DestroyShadowMemoryOnDG2();
188188

189+
m_Quarantine = nullptr;
190+
m_MemBufferMap.clear();
191+
m_AllocationMap.clear();
192+
m_KernelMap.clear();
193+
m_ContextMap.clear();
194+
189195
for (auto Adapter : m_Adapters) {
190196
getContext()->urDdiTable.Global.pfnAdapterRelease(Adapter);
191197
}

source/loader/layers/sanitizer/ur_sanddi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGet(
6666
}
6767

6868
ur_result_t result = pfnAdapterGet(NumEntries, phAdapters, pNumAdapters);
69-
if (result == UR_RESULT_SUCCESS) {
69+
if (result == UR_RESULT_SUCCESS && phAdapters) {
7070
const uint32_t NumAdapters = pNumAdapters ? *pNumAdapters : NumEntries;
7171
for (uint32_t i = 0; i < NumAdapters; ++i) {
7272
UR_CALL(getContext()->interceptor->holdAdapter(phAdapters[i]));

source/loader/ur_lib.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ void context_t::initLayers() const {
5757
}
5858

5959
void context_t::tearDownLayers() const {
60-
for (auto &[layer, destroy] : layers) {
60+
for (auto it = layers.rbegin(); it != layers.rend(); ++it) {
61+
auto [layer, destroy] = *it;
6162
layer->tearDown();
6263
destroy();
6364
}

0 commit comments

Comments
 (0)