Skip to content

Commit 9210e0f

Browse files
committed
Use a copy of the peers list string for parsing during raftable init.
1 parent 6d3b1dc commit 9210e0f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

contrib/raftable/worker.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,12 @@ void parse_peers(HostPort *peers, char *peerstr)
457457
char *host;
458458
int id, port;
459459
int i;
460+
peerstr = pstrdup(peerstr);
460461

461462
for (i = 0; i < RAFTABLE_PEERS_MAX; i++)
462463
peers[i].up = false;
463464

465+
464466
fprintf(stderr, "parsing '%s'\n", peerstr);
465467
peer = strtok_r(peerstr, ",", &state);
466468
while (peer)
@@ -488,4 +490,6 @@ void parse_peers(HostPort *peers, char *peerstr)
488490

489491
peer = strtok_r(NULL, ",", &state);
490492
}
493+
494+
pfree(peerstr);
491495
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy