rebase: fix a memory leak