SEA-1252: Memory leak with index schemas
(cherry picked from commit e1d0616)