From e2046b300373093e0e4640e97d6dbdb8bb7cd221 Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Mon, 8 Jun 2020 09:43:10 +0300 Subject: [PATCH] Don't queue commands in an already aborted MULTI state --- src/multi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/multi.c b/src/multi.c index a331a624088..3e606fcec5a 100644 --- a/src/multi.c +++ b/src/multi.c @@ -58,6 +58,13 @@ void queueMultiCommand(client *c) { multiCmd *mc; int j; + /* No sense to waste memory if the transaction is already aborted. + * this is useful in case client sends these in a pipeline, or doesn't + * bother to read previous responses and didn't notice the multi was already + * aborted. */ + if (c->flags & CLIENT_DIRTY_EXEC) + return; + c->mstate.commands = zrealloc(c->mstate.commands, sizeof(multiCmd)*(c->mstate.count+1)); mc = c->mstate.commands+c->mstate.count;