Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4998537

Browse files
knizhnikkelvich
authored andcommitted
Fix bug in MtmSplitConnStrs
1 parent a772bdc commit 4998537

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

multimaster.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,8 @@ void MtmUpdateNodeConnStr(int nodeId, char const* connStr)
12081208
static void MtmSplitConnStrs(void)
12091209
{
12101210
int i;
1211-
char* connStr = strdup(MtmConnStrs);
1211+
char* copy = strdup(MtmConnStrs);
1212+
char* connStr = copy;
12121213
char* connStrEnd = connStr + strlen(connStr);
12131214

12141215
for (i = 0; connStr < connStrEnd; i++) {
@@ -1237,7 +1238,7 @@ static void MtmSplitConnStrs(void)
12371238
}
12381239
connStr = p + 1;
12391240
}
1240-
free(connStr);
1241+
free(copy);
12411242
if (i < 2) {
12421243
elog(ERROR, "Multimaster should have at least two nodes");
12431244
}

0 commit comments

Comments
 (0)