From 76d8c67b5225146a4664fe1eded4530527e04014 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Sat, 2 Jan 2016 19:29:17 +0000 Subject: [PATCH] Fix the mutex logic in fifo.c from the espeak_ng_STATUS changes. --- src/libespeak-ng/fifo.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/libespeak-ng/fifo.c b/src/libespeak-ng/fifo.c index 475703f6..a01104c6 100644 --- a/src/libespeak-ng/fifo.c +++ b/src/libespeak-ng/fifo.c @@ -95,8 +95,10 @@ espeak_ng_STATUS fifo_add_command(t_espeak_command *the_command) if ((status = pthread_mutex_lock(&my_mutex)) != ENS_OK) return status; - if ((status = push(the_command)) != ENS_OK) + if ((status = push(the_command)) != ENS_OK) { + pthread_mutex_unlock(&my_mutex); return status; + } if ((status = pthread_mutex_unlock(&my_mutex)) != ENS_OK) return status; @@ -124,11 +126,15 @@ espeak_ng_STATUS fifo_add_commands(t_espeak_command *command1, t_espeak_command if (node_counter+1 >= MAX_NODE_COUNTER) return ENS_FIFO_BUFFER_FULL; - if ((status = push(command1)) != ENS_OK) + if ((status = push(command1)) != ENS_OK) { + pthread_mutex_unlock(&my_mutex); return status; + } - if ((status = push(command2)) != ENS_OK) + if ((status = push(command2)) != ENS_OK) { + pthread_mutex_unlock(&my_mutex); return status; + } if ((status = pthread_mutex_unlock(&my_mutex)) != ENS_OK) return status;