fixed memory leak in issue 1493