Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] box/request: add missing diag_set on tuple alloc failure
@ 2020-01-17 12:29 Cyrill Gorcunov
  2020-01-17 13:29 ` Cyrill Gorcunov
  0 siblings, 1 reply; 2+ messages in thread
From: Cyrill Gorcunov @ 2020-01-17 12:29 UTC (permalink / raw)
  To: tml

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@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-17 13:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17 12:29 [Tarantool-patches] [PATCH] box/request: add missing diag_set on tuple alloc failure Cyrill Gorcunov
2020-01-17 13:29 ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox