delay freeing the old am_ppref so that if we bail early due to malloc() failures, valid ppref data hasn't been freed for no reason. Based on comments from enami.