Skip to content

Commit 623c3f6

Browse files
grooverdansvoj
authored andcommitted
thread_group_close: release mutex in all branches
Found by Coverity scan - id 92087
1 parent cb87067 commit 623c3f6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sql/threadpool_unix.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -979,24 +979,26 @@ static void thread_group_close(thread_group_t *thread_group)
979979

980980
if (pipe(thread_group->shutdown_pipe))
981981
{
982-
DBUG_VOID_RETURN;
982+
goto end;
983983
}
984984

985985
/* Wake listener */
986986
if (io_poll_associate_fd(thread_group->pollfd,
987987
thread_group->shutdown_pipe[0], NULL))
988988
{
989-
DBUG_VOID_RETURN;
989+
goto end;
990+
}
991+
{
992+
char c= 0;
993+
if (write(thread_group->shutdown_pipe[1], &c, 1) < 0)
994+
goto end;
990995
}
991-
char c= 0;
992-
if (write(thread_group->shutdown_pipe[1], &c, 1) < 0)
993-
DBUG_VOID_RETURN;
994-
995996
/* Wake all workers. */
996997
while(wake_thread(thread_group) == 0)
997998
{
998999
}
9991000

1001+
end:
10001002
mysql_mutex_unlock(&thread_group->mutex);
10011003

10021004
DBUG_VOID_RETURN;

0 commit comments

Comments
 (0)