Fix memory leak in preview editor.