Fixes a small memory leak when creating view