Fix memory leak in ManageApplication