Fix resource leak in logging plugin.