diff --git a/src/net/reply.c b/src/net/reply.c index 0efd92823..a331ae6cf 100644 --- a/src/net/reply.c +++ b/src/net/reply.c @@ -39,13 +39,13 @@ void _z_reply_data_free(_z_reply_data_t **reply_data) { } z_result_t _z_reply_data_copy(_z_reply_data_t *dst, const _z_reply_data_t *src) { - *dst = _z_reply_data_null(); - dst->_tag = src->_tag; + *dst = _z_reply_data_init(); if (src->_tag == _Z_REPLY_TAG_DATA) { _Z_RETURN_IF_ERR(_z_sample_copy(&dst->_result.sample, &src->_result.sample)); } else if (src->_tag == _Z_REPLY_TAG_ERROR) { _Z_RETURN_IF_ERR(_z_value_copy(&dst->_result.error, &src->_result.error)); } + dst->_tag = src->_tag; dst->replier_id = src->replier_id; return _Z_RES_OK; }