Skip to content

Commit 831195d

Browse files
committed
Add a condition to prevend freeing NULL msg when dropping a client that hasn't sent anything yet.
1 parent d0f060a commit 831195d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

contrib/raftable/t/000_basic.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ sub start_nodes
7171
$able->psql('postgres', "select raftable('hello', '$tests{hello}');");
7272
$baker->psql('postgres', "select raftable('and', '$tests{and}');");
7373
$charlie->psql('postgres', "select raftable('goodbye', '$tests{goodbye}');");
74-
#$baker->stop;
74+
$baker->stop;
7575
$able->psql('postgres', "select raftable('world', '$tests{world}');");
7676

77-
#$baker->start;
77+
$baker->start;
78+
sleep(5);
7879
while (my ($key, $value) = each(%tests))
7980
{
8081
my $o = $baker->psql('postgres', "select raftable('$key');");

contrib/raftable/worker.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static bool remove_client(Client *c)
169169
int sock = c->sock;
170170
Assert(sock >= 0);
171171
c->sock = -1;
172-
pfree(c->msg);
172+
if (c->msg) pfree(c->msg);
173173

174174
server.clientnum--;
175175
close(sock);

0 commit comments

Comments
 (0)