Replace a manual buffer allocation with std::vector
am: b2b3323f45

Change-Id: I1f975913b04338073a6dd576614ecc0963bcaf8b