I'm not very familiar with the code, but reading CCoinsViewCache::AddCoin, I noticed something that might cause inconsistency:
https://github.com/bitcoin/bitcoin/blob/2fc94370f510f6d1fbd7a6a6cdedf2b14a3e9fb2/src/coins.cpp#L74
The memory usage of the old element is subtracted, even though it's possible to raise an error lateron, leaving the original element in place.
I might be missing something, though.