tdb: Don't malloc for every record in traverse