Fix buffer allocation

b/15293123

Change-Id: Icb3ceabf02a55bc931baaf388ce125db6332de0e