Check lock/unlock pairs in a function