If `CMSTemplate::takeSession()` returns NULL in `CMSTemplate::execute`, it is dereferenced in `CmsTemplate::createConsumer`. As far as I could tell, this is a plausible scenario, but I could be wrong. It looks like `ProducerExecutor::doInCms` checks for a NULL session, but `ReceiveExecutor::doInCms` does not. If this is because it is known that the session cannot be NULL, please close this issue. It just looked a bit off to me.