1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-28 01:41:48 +03:00

examples: Avoid accessing list before acquiring lock

Thanks coverity

CID 1526592

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
Jakub Jelen
2023-11-23 15:03:14 +01:00
parent 46ab527bbe
commit 54ac7c95e8

View File

@ -343,10 +343,11 @@ static void delete_item(ssh_channel channel)
static node_t *search_item(ssh_channel channel)
{
node_t *current = node;
node_t *current = NULL;
pthread_mutex_lock(&mutex);
current = node;
while (current != NULL) {
if (current->channel == channel) {
pthread_mutex_unlock(&mutex);