From 12b56a969f03ff2e0e28704ff2c30875ea836fe0 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 10 Sep 2014 15:41:05 +0200 Subject: [PATCH] luaRedisGenericCommand() cached argv handling simplified. As discussed in issue #1945. --- src/scripting.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/scripting.c b/src/scripting.c index 50e1ef10c..5cd0b299c 100644 --- a/src/scripting.c +++ b/src/scripting.c @@ -222,10 +222,7 @@ int luaRedisGenericCommand(lua_State *lua, int raise_error) { } /* Build the arguments vector */ - if (!argv) { - argv = zmalloc(sizeof(robj*)*argc); - argv_size = argc; - } else if (argv_size < argc) { + if (argv_size < argc) { argv = zrealloc(argv,sizeof(robj*)*argc); argv_size = argc; } @@ -403,6 +400,7 @@ cleanup: if (c->argv != argv) { zfree(c->argv); argv = NULL; + argv_size = 0; } if (raise_error) {