Skip to content

Commit e2046b3

Browse files
oranagraantirez
authored andcommitted
Don't queue commands in an already aborted MULTI state
1 parent b35fdf1 commit e2046b3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/multi.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ void queueMultiCommand(client *c) {
5858
multiCmd *mc;
5959
int j;
6060

61+
/* No sense to waste memory if the transaction is already aborted.
62+
* this is useful in case client sends these in a pipeline, or doesn't
63+
* bother to read previous responses and didn't notice the multi was already
64+
* aborted. */
65+
if (c->flags & CLIENT_DIRTY_EXEC)
66+
return;
67+
6168
c->mstate.commands = zrealloc(c->mstate.commands,
6269
sizeof(multiCmd)*(c->mstate.count+1));
6370
mc = c->mstate.commands+c->mstate.count;

0 commit comments

Comments
 (0)