Commit efc71a3c authored by Ben Wagner's avatar Ben Wagner Committed by Akira TAGOH
Browse files

Free local FcCache lock on contention

If two threads attempt to create the FcCache lock in lock_cache at the
same time, both threads may create and initialize a local FcMutex. One
thread will atomically make cache_lock point to its FcMutex. The other
thread currently calls FcMutexFinish on the local lock, but does not
free it. Change this behavior to free the unused lock.

Found with test/test-pthread on an LeakSanitizer enabled build.
parent 6e687630
Pipeline #395613 passed with stage
in 14 minutes and 22 seconds
......@@ -495,6 +495,7 @@ retry:
FcMutexInit (lock);
if (!fc_atomic_ptr_cmpexch (&cache_lock, NULL, lock)) {
FcMutexFinish (lock);
free (lock);
goto retry;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment