mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +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:
@ -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;
|
||||
|
Reference in New Issue
Block a user