MB-9098: Acquire lock to retrieve list size

- Need for synchronizing access to shared data
to avoid segmentation faults and possible
memory corruption.

Change-Id: If02dcf0d61a397960f0e7bd0b738fe1bb5f93cbb
Reviewed-on: http://review.couchbase.org/29477
Reviewed-by: abhinav dangeti <abhinav.dangeti@gmail.com>
Tested-by: abhinav dangeti <abhinav.dangeti@gmail.com>