summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2020-06-08 11:08:08 +0200
committerGitHub <noreply@github.com>2020-06-08 11:08:08 +0200
commit254f06c131dc2ca1e1b7a8112d03006954fb09cb (patch)
treec939eeb1a7fa7784d2dc6d7f9544ba2a1086c9e6
parent8183a4ca7f23e93d001e927041f4da9794b382d8 (diff)
parent2bb297b1029cf8938fe61b505450416dad3ea5ad (diff)
downloadredis-254f06c131dc2ca1e1b7a8112d03006954fb09cb.tar.gz
Merge pull request #7370 from oranagra/no_queue_in_aborted_multi
Don't queue commands in an already aborted MULTI state
-rw-r--r--src/multi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/multi.c b/src/multi.c
index a331a6240..3e606fcec 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;