feature #2858: Fix minor memory leaks