[Tarantool-patches] [PATCH v20 1/7] box/schema: make sure hashes are created

Cyrill Gorcunov gorcunov at gmail.com
Fri Apr 2 15:34:14 MSK 2021


These are critical structures, strictly speaking
if malloc has failed we're likely under heavy memory
pressure and won't continue anyway but better to exit
explicitly.

In-scope-of #4642

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 src/box/schema.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/box/schema.cc b/src/box/schema.cc
index 963278b19..89904e4d2 100644
--- a/src/box/schema.cc
+++ b/src/box/schema.cc
@@ -372,6 +372,13 @@ schema_init(void)
 	funcs = mh_i32ptr_new();
 	funcs_by_name = mh_strnptr_new();
 	sequences = mh_i32ptr_new();
+
+	if (spaces == NULL || spaces_by_name == NULL ||
+	    funcs == NULL || funcs_by_name == NULL ||
+	    sequences == NULL) {
+		panic("Can't allocate schema hashes");
+	}
+
 	/*
 	 * Create surrogate space objects for the mandatory system
 	 * spaces (the primal eggs from which we get all the
-- 
2.30.2



More information about the Tarantool-patches mailing list