Use a buffer for storing marshal output

Signed-off-by: Tim Jarratt <tjarratt@pivotallabs.com>