summaryrefslogtreecommitdiffstats
path: root/contrib/restricted/wavm/patches/0017-do-not-return-nullptr.patch
blob: 8c51b2c3be7908d3d5e81ec1591c9d6708b2be1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/contrib/restricted/wavm/Lib/Runtime/Global.cpp b/contrib/restricted/wavm/Lib/Runtime/Global.cpp
--- a/contrib/restricted/wavm/Lib/Runtime/Global.cpp
+++ b/contrib/restricted/wavm/Lib/Runtime/Global.cpp
@@ -41,6 +41,7 @@ Global* Runtime::createGlobal(Compartment* compartment,
 		if(global->id == UINTPTR_MAX)
 		{
 			delete global;
+			WAVM_ASSERT(global->id != UINTPTR_MAX);
 			return nullptr;
 		}
 	}
diff --git a/contrib/restricted/wavm/Lib/Runtime/Instance.cpp b/contrib/restricted/wavm/Lib/Runtime/Instance.cpp
--- a/contrib/restricted/wavm/Lib/Runtime/Instance.cpp
+++ b/contrib/restricted/wavm/Lib/Runtime/Instance.cpp
@@ -175,7 +175,7 @@ Instance* Runtime::instantiateModuleInternal(Compartment* compartment,
 		Platform::RWMutex::ExclusiveLock compartmentLock(compartment->mutex);
 		id = compartment->instances.add(UINTPTR_MAX, nullptr);
 	}
-	if(id == UINTPTR_MAX) { return nullptr; }
+	WAVM_ASSERT(id != UINTPTR_MAX);
 
 	// Deserialize the disassembly names.
 	DisassemblyNames disassemblyNames;