Fix logging filter over-allocation and leak.

The leak could happen in a couple cases where adding a log filter
fails: OOM and unsupported field type.