1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-31 00:03:07 +03:00

examples: Unlock mux before returning

Thanks to coverity!

CID 1517788

Signed-off-by: Norbert Pocs <npocs@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Norbert Pocs
2023-07-12 09:06:54 +02:00
parent 393a9bf82c
commit 321e468eca

View File

@ -282,6 +282,7 @@ static int insert_item(ssh_channel channel, int fd_in, int fd_out,
/* Calloc ensure that node is full of 0 */
node = (node_t *) calloc(1, sizeof(node_t));
if (node == NULL) {
pthread_mutex_unlock(&mutex);
return -1;
}
node->channel = channel;
@ -297,6 +298,7 @@ static int insert_item(ssh_channel channel, int fd_in, int fd_out,
/* Create the new node */
new = (node_t *) malloc(sizeof(node_t));
if (new == NULL) {
pthread_mutex_unlock(&mutex);
return -1;
}
new->channel = channel;