Our code analyzer has reported a memory leak in repl function of redis-cli.c#L1317

                } else if (strcasecmp(argv[0],"restart") == 0) {
                    if (config.eval) {
                        config.eval_ldb = 1;
                        config.output = OUTPUT_RAW;
                        /* ==> when this returned, line and argv variables will leak */
                        return; /* Return to evalMode to restart the session. */
                    } else {
                        printf("Use 'restart' only in Lua debugging mode.");
                    }

Inside lua debugger mode, repeatedly use "restart" command, will leak memory that line and argv pointed to.

I don't think it is a dangerous memory leak, since it just can be triggered in a lua debugger mode, but it could easily fixed by adding sdsfreesplitres(argv,argc) and linenoiseFree(line) before return to evalMode.

Might anyone have a look and see if it is a true issue, then I would like to pull a request to fix it.

Regards, Alex, SourceBrella Inc.

Comment From: richardxx

Hi, guys, our engineer kindly reported this bug, please have a look. Thanks.

Comment From: sundb

@richardxx Already fixed in #4932.