Sfoglia il codice sorgente

Fix dxilconv crash when initialization fails (#3254)

Helena Kotas 4 anni fa
parent
commit
a39e52dd81
1 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 4 4
      lib/DxcSupport/dxcmem.cpp

+ 4 - 4
lib/DxcSupport/dxcmem.cpp

@@ -58,12 +58,12 @@ IMalloc *DxcGetThreadMallocNoRef() throw() {
 }
 
 void DxcClearThreadMalloc() throw() {
-  IMalloc *pMalloc = DxcGetThreadMallocNoRef();
   if (g_ThreadMallocTls != nullptr) {
+    IMalloc *pMalloc = DxcGetThreadMallocNoRef();
     g_ThreadMallocTls->erase();
-  }
-  if (pMalloc != nullptr) {
-    pMalloc->Release();
+    if (pMalloc != nullptr) {
+      pMalloc->Release();
+    }
   }
 }