cbson: add a couple of checks on return values.