mirror of
https://github.com/shadps4-emu/ext-libusb.git
synced 2026-01-31 00:55:21 +01:00
core: Add missing mutex acquisition when manipulating active_contexts_list
The `active_contexts_list` is supposed to be protected by the `active_contexts_lock` mutex. Upon code review, found one place where the mutex was not acquired. Closes #1413
This commit is contained in:
committed by
Tormod Volden
parent
a8fba21b7f
commit
7ab9c93d7d
@@ -2445,10 +2445,12 @@ int API_EXPORTED libusb_init_context(libusb_context **ctx, const struct libusb_i
|
||||
}
|
||||
|
||||
/* check for first init */
|
||||
usbi_mutex_static_lock(&active_contexts_lock);
|
||||
if (!active_contexts_list.next) {
|
||||
list_init(&active_contexts_list);
|
||||
usbi_get_monotonic_time(×tamp_origin);
|
||||
}
|
||||
usbi_mutex_static_unlock(&active_contexts_lock);
|
||||
|
||||
_ctx = calloc(1, PTR_ALIGN(sizeof(*_ctx)) + priv_size);
|
||||
if (!_ctx) {
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define LIBUSB_NANO 11862
|
||||
#define LIBUSB_NANO 11863
|
||||
|
||||
Reference in New Issue
Block a user