Skip to content

Commit

Permalink
fix: queryables issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jean-roland committed Dec 3, 2024
1 parent e530209 commit 01fbc12
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/collections/bytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ z_result_t _z_bytes_copy(_z_bytes_t *dst, const _z_bytes_t *src) {

_z_bytes_t _z_bytes_alias(const _z_bytes_t src) {
_z_bytes_t dst;
dst._slices = _z_arc_slice_svec_alias(&src._slices);
dst._slices = src._slices;
return dst;
}

Expand Down
2 changes: 1 addition & 1 deletion src/net/encoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ _z_encoding_t _z_encoding_alias(_z_encoding_t src) {
_z_encoding_t dst;
dst.id = src.id;
if (_z_string_check(&src.schema)) {
_z_string_alias(src.schema);
dst.schema = _z_string_alias(src.schema);
} else {
dst.schema = _z_string_null();
}
Expand Down
2 changes: 1 addition & 1 deletion src/net/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static void _z_query_clear_inner(_z_query_t *q) {
z_result_t _z_query_send_reply_final(_z_query_t *q) {
// Try to upgrade session weak to rc
_z_session_rc_t sess_rc = _z_session_weak_upgrade_if_open(&q->_zn);
if (!_Z_RC_IS_NULL(&sess_rc)) {
if (_Z_RC_IS_NULL(&sess_rc)) {
return _Z_ERR_TRANSPORT_TX_FAILED;
}
_z_zenoh_message_t z_msg = _z_n_msg_make_response_final(q->_request_id);
Expand Down
10 changes: 9 additions & 1 deletion src/session/queryable.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static z_result_t _z_session_queryable_get_infos(_z_session_t *zn, const _z_keye
return _Z_RES_OK;
}

static z_result_t _z_trigger_queryables_inner(_z_session_rc_t *zsrc, _z_msg_query_t *msgq, const _z_keyexpr_t *q_key,
static z_result_t _z_trigger_queryables_inner(_z_session_rc_t *zsrc, _z_msg_query_t *msgq, _z_keyexpr_t *q_key,
uint32_t qid) {
_z_session_t *zn = _Z_RC_IN_VAL(zsrc);
_z_keyexpr_t key;
Expand All @@ -227,6 +227,14 @@ static z_result_t _z_trigger_queryables_inner(_z_session_rc_t *zsrc, _z_msg_quer
_z_query_t q =
_z_query_alias(&msgq->_ext_value, &key, &msgq->_parameters, zsrc, qid, &msgq->_ext_attachment, anyke);
_z_query_rc_t query = _z_query_rc_new_from_val(&q);
if (_Z_RC_IS_NULL(&query)) {
return _Z_ERR_SYSTEM_OUT_OF_MEMORY;
}
// Clear values to avoid double free
*q_key = _z_keyexpr_null();
msgq->_ext_value = _z_value_null();
msgq->_ext_attachment = _z_bytes_null();
msgq->_parameters = _z_slice_null();
// Parse session_queryable svec
for (size_t i = 0; i < qle_nb; i++) {
_z_queryable_infos_t *qle_info = _z_queryable_infos_svec_get(&qles, i);
Expand Down

0 comments on commit 01fbc12

Please sign in to comment.