Fixed memory leak in gridstream