summaryrefslogtreecommitdiff
path: root/toxcore/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/util.c')
-rw-r--r--toxcore/util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/toxcore/util.c b/toxcore/util.c
index 93e63ac2..5a72c4a4 100644
--- a/toxcore/util.c
+++ b/toxcore/util.c
@@ -170,12 +170,16 @@ int create_recursive_mutex(pthread_mutex_t *mutex)
170 if (pthread_mutexattr_init(&attr) != 0) 170 if (pthread_mutexattr_init(&attr) != 0)
171 return -1; 171 return -1;
172 172
173 if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) 173 if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) {
174 pthread_mutexattr_destroy(&attr);
174 return -1; 175 return -1;
176 }
175 177
176 /* Create queue mutex */ 178 /* Create queue mutex */
177 if (pthread_mutex_init(mutex, &attr) != 0) 179 if (pthread_mutex_init(mutex, &attr) != 0) {
180 pthread_mutexattr_destroy(&attr);
178 return -1; 181 return -1;
182 }
179 183
180 pthread_mutexattr_destroy(&attr); 184 pthread_mutexattr_destroy(&attr);
181 185