iobuf_append() refactored: allocating exactly as many bytes as needed