From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 210F54696C3 for ; Fri, 17 Jan 2020 16:29:59 +0300 (MSK) Received: by mail-lj1-f193.google.com with SMTP id j26so26447568ljc.12 for ; Fri, 17 Jan 2020 05:29:59 -0800 (PST) From: Cyrill Gorcunov Date: Fri, 17 Jan 2020 16:29:29 +0300 Message-Id: <20200117132929.11235-3-gorcunov@gmail.com> In-Reply-To: <20200117132929.11235-1-gorcunov@gmail.com> References: <20200117132929.11235-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 2/2] box/applier: add missing diag_set on region_alloc failure List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml In case if we're hitting memory limit allocting triggers we should setup diag error to prevent nil dereference in diag_raise call for example from applier_apply_tx. Signed-off-by: Cyrill Gorcunov --- src/box/applier.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/box/applier.cc b/src/box/applier.cc index 1a051e8c4..5b1efdabe 100644 --- a/src/box/applier.cc +++ b/src/box/applier.cc @@ -714,8 +714,11 @@ applier_apply_tx(struct stailq *rows) sizeof(struct trigger)); on_commit = (struct trigger *)region_alloc(&txn->region, sizeof(struct trigger)); - if (on_rollback == NULL || on_commit == NULL) + if (on_rollback == NULL || on_commit == NULL) { + diag_set(OutOfMemory, sizeof(struct trigger), + "region_alloc", "on_rollback/on_commit"); goto rollback; + } trigger_create(on_rollback, applier_txn_rollback_cb, NULL, NULL); txn_on_rollback(txn, on_rollback); -- 2.20.1