From e2de7e75248a928280d6c739e9020d8c8adc1c0f Mon Sep 17 00:00:00 2001 From: "zhaozhao.zz" Date: Wed, 17 Oct 2018 16:40:45 +0800 Subject: [PATCH] MULTI: OOM err if cannot free enough memory in MULTI/EXEC context --- src/server.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server.c b/src/server.c index 0118250b..d6c6dc3a 100644 --- a/src/server.c +++ b/src/server.c @@ -2619,8 +2619,11 @@ int processCommand(client *c) { if (server.current_client == NULL) return C_ERR; /* It was impossible to free enough memory, and the command the client - * is trying to execute is denied during OOM conditions? Error. */ - if ((c->cmd->flags & CMD_DENYOOM) && out_of_memory) { + * is trying to execute is denied during OOM conditions or the client + * is in MULTI/EXEC context? Error. */ + if (out_of_memory && + (c->cmd->flags & CMD_DENYOOM || + (c->flags & CLIENT_MULTI && c->cmd->proc != execCommand))) { flagTransaction(c); addReply(c, shared.oomerr); return C_OK;