Fix error path so mutex is unlocked before returning
authorOle André Vadla Ravnås <oleavr@gmail.com>
Wed, 15 Mar 2017 00:23:40 +0000 (01:23 +0100)
committerOle André Vadla Ravnås <oleavr@gmail.com>
Wed, 15 Mar 2017 00:27:43 +0000 (01:27 +0100)
In the unusual case where ffi_trampoline_table_alloc() fails.

src/closures.c

index 2e0ffb4..78d6aeb 100644 (file)
@@ -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;
        }