diff options
author | Oran Agra <oran@redislabs.com> | 2020-06-08 09:43:10 +0300 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2020-06-08 09:43:10 +0300 |
commit | 2bb297b1029cf8938fe61b505450416dad3ea5ad (patch) | |
tree | 804a12f5f6bb6c6f8150addf4f2073e919c317da | |
parent | 44b76a75d2d9778491e6bf27119d32315706eda2 (diff) | |
download | redis-2bb297b1029cf8938fe61b505450416dad3ea5ad.tar.gz |
Don't queue commands in an already aborted MULTI state
-rw-r--r-- | src/multi.c | 7 |
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; |