Commit d42ce7b95c6d5cba7d976cc0c8c85f7645fa6b8f

Ole André Vadla Ravnås 2017-03-15T01:23:40

Fix error path so mutex is unlocked before returning In the unusual case where ffi_trampoline_table_alloc() fails.

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/closures.c b/src/closures.c
index 2e0ffb4..78d6aeb 100644
--- a/src/closures.c
+++ b/src/closures.c
@@ -211,6 +211,7 @@ ffi_closure_alloc (size_t size, void **code)
       table = ffi_trampoline_table_alloc ();
       if (table == NULL)
 	{
+	  pthread_mutex_unlock (&ffi_trampoline_lock);
 	  free (closure);
 	  return NULL;
 	}