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

Change-Id: I77ff2a7a84d62cc4871b4ddf75a94ab42d64951f