[Tarantool-patches] [PATCH] box/request: add missing diag_set on tuple alloc failure

Cyrill Gorcunov gorcunov at gmail.com
Fri Jan 17 15:29:03 MSK 2020


In case if region_alloc failed we should setup diag
error so the caller would be notified.

Otherwise the caller may do diag_raise and get
nil dereference.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
The patch is on top of commit b89c62bd78bef94e199fddb9920a771e7b8dc325 (origin/2.2)
Might be related to https://github.com/tarantool/tarantool/issues/4730

 src/box/request.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/box/request.c b/src/box/request.c
index 82232a155..a460392c9 100644
--- a/src/box/request.c
+++ b/src/box/request.c
@@ -199,8 +199,10 @@ request_handle_sequence(struct request *request, struct space *space)
 		size_t buf_size = (request->tuple_end - request->tuple) +
 						mp_sizeof_uint(UINT64_MAX);
 		char *tuple = region_alloc(&fiber()->gc, buf_size);
-		if (tuple == NULL)
+		if (tuple == NULL) {
+			diag_set(OutOfMemory, buf_size, "region_alloc", "tuple");
 			return -1;
+		}
 		char *tuple_end = mp_encode_array(tuple, len);
 
 		if (unlikely(key != data)) {
-- 
2.20.1



More information about the Tarantool-patches mailing list