Cleanup in redis-cli and tests: release memory on exit, change dup test name (#8475)
1. Rename 18-cluster-nodes-slots.tcl to 19-cluster-nodes-slots.tcl. it was conflicting with another test prefixed by 18 2. Release memory on exit in redis-cli.c. 3. Fix freeConvertedSds indentation.
This commit is contained in:
parent
8f9958dc24
commit
203f357c32
@ -1938,6 +1938,13 @@ static char **convertToSds(int count, char** args) {
|
||||
return sds;
|
||||
}
|
||||
|
||||
static void freeConvertedSds(int count, char **sds) {
|
||||
int j;
|
||||
for (j = 0; j < count; j++)
|
||||
sdsfree(sds[j]);
|
||||
zfree(sds);
|
||||
}
|
||||
|
||||
static int issueCommandRepeat(int argc, char **argv, long repeat) {
|
||||
while (1) {
|
||||
config.cluster_reissue_command = 0;
|
||||
@ -2168,13 +2175,17 @@ static void repl(void) {
|
||||
|
||||
static int noninteractive(int argc, char **argv) {
|
||||
int retval = 0;
|
||||
|
||||
argv = convertToSds(argc, argv);
|
||||
if (config.stdinarg) {
|
||||
argv = zrealloc(argv, (argc+1)*sizeof(char*));
|
||||
argv[argc] = readArgFromStdin();
|
||||
retval = issueCommand(argc+1, argv);
|
||||
sdsfree(argv[argc]);
|
||||
} else {
|
||||
retval = issueCommand(argc, argv);
|
||||
}
|
||||
freeConvertedSds(argc, argv);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -8331,6 +8342,6 @@ int main(int argc, char **argv) {
|
||||
if (config.eval) {
|
||||
return evalMode(argc,argv);
|
||||
} else {
|
||||
return noninteractive(argc,convertToSds(argc,argv));
|
||||
return noninteractive(argc,argv);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user