From 321e468ecaf721b6c8ab029c9abf118f3ac44dec Mon Sep 17 00:00:00 2001 From: Norbert Pocs Date: Wed, 12 Jul 2023 09:06:54 +0200 Subject: [PATCH] examples: Unlock mux before returning Thanks to coverity! CID 1517788 Signed-off-by: Norbert Pocs Reviewed-by: Jakub Jelen Reviewed-by: Andreas Schneider --- examples/ssh_X11_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/ssh_X11_client.c b/examples/ssh_X11_client.c index add09681..b3fa0e2d 100644 --- a/examples/ssh_X11_client.c +++ b/examples/ssh_X11_client.c @@ -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;