Fixed memory leak in Quad and RegionQuad