Fixed coverity reported concurrency issue

Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>