Skip to content

Commit

Permalink
Fix clusterLoadConfig aux_argv minor memory leak
Browse files Browse the repository at this point in the history
We forgot to call sdsfreesplitres. This is just a cleanup since it will
only be leaked in the error paths, and we will exit on the error paths.
  • Loading branch information
enjoy-binbin committed Nov 5, 2023
1 parent 28b6155 commit 9f5c319
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ int clusterLoadConfig(char *filename) {
if (field_argv == NULL || field_argc != 2) {
/* Invalid aux field format */
if (field_argv != NULL) sdsfreesplitres(field_argv, field_argc);
sdsfreesplitres(aux_argv, aux_argc);
sdsfreesplitres(argv,argc);
goto fmterr;
}
Expand All @@ -479,6 +480,7 @@ int clusterLoadConfig(char *filename) {
if (!isValidAuxString(field_argv[j],sdslen(field_argv[j]))){
/* Invalid aux field format */
sdsfreesplitres(field_argv, field_argc);
sdsfreesplitres(aux_argv, aux_argc);
sdsfreesplitres(argv,argc);
goto fmterr;
}
Expand All @@ -498,6 +500,7 @@ int clusterLoadConfig(char *filename) {
if (auxFieldHandlers[j].setter(n, field_argv[1], sdslen(field_argv[1])) != C_OK) {
/* Invalid aux field format */
sdsfreesplitres(field_argv, field_argc);
sdsfreesplitres(aux_argv, aux_argc);
sdsfreesplitres(argv,argc);
goto fmterr;
}
Expand All @@ -506,6 +509,7 @@ int clusterLoadConfig(char *filename) {
if (field_found == 0) {
/* Invalid aux field format */
sdsfreesplitres(field_argv, field_argc);
sdsfreesplitres(aux_argv, aux_argc);
sdsfreesplitres(argv,argc);
goto fmterr;
}
Expand Down

0 comments on commit 9f5c319

Please sign in to comment.