The lock here is meaningless because you return a pointer value.
Is this to pass a race detector?