Fixed memory leak for dispatch_semaphore