Add NULL check for Linux shared lock detach

Signed-off-by: Shahbaz Youssefi <ShabbyX@gmail.com>