1
0
mirror of https://github.com/fluencelabs/redis synced 2025-07-03 19:01:33 +00:00

Lua debugger: use sds_malloc() to allocate eval cli array.

Redis-cli handles the debugger "eval" command in a special way since
sdssplitargs() would not be ok: we need to send the Redis debugger the
whole Lua script without any parsing. However in order to later free the
argument vector inside redis-cli using just sdsfreesplitres(), we need
to allocate the array of SDS pointers using the same allocator SDS is
using, that may differ to what Redis is using.

So now a newer version of SDS exports sds_malloc() and other allocator
functions to give access, to the program it is linked to, the allocator
used internally by SDS.
This commit is contained in:
antirez
2015-11-16 10:29:35 +01:00
parent 34aadf79c3
commit e57cccdefb
5 changed files with 35 additions and 1 deletions

@ -1050,7 +1050,7 @@ static sds *cliSplitArgs(char *line, int *argc) {
if (config.eval_ldb && (strstr(line,"eval ") == line ||
strstr(line,"e ") == line))
{
sds *argv = zmalloc(sizeof(sds)*2);
sds *argv = sds_malloc(sizeof(sds)*2);
*argc = 2;
int len = strlen(line);
int elen = line[1] == ' ' ? 2 : 5; /* "e " or "eval "? */