Resize output buffer if size changed