Skip to content

Commit

Permalink
memory leak fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisBiryukov91 committed Feb 27, 2025
1 parent 7e5809b commit 36ad031
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/session/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,14 @@ static z_result_t _z_trigger_query_reply_partial_inner(_z_session_t *zn, const _
// No need to store the whole reply in the monotonic mode.
pen_rep->_reply = _z_reply_null();
pen_rep->_reply.data._tag = _Z_REPLY_TAG_DATA;
pen_rep->_reply.data._result.sample.keyexpr = _z_keyexpr_duplicate(&reply.data._result.sample.keyexpr);
_Z_CLEAN_RETURN_IF_ERR(
_z_keyexpr_move(&pen_rep->_reply.data._result.sample.keyexpr, &reply.data._result.sample.keyexpr),
_z_reply_clear(&reply);
_z_session_mutex_unlock(zn));
} else {
// Copy the reply to store it out of context
_Z_CLEAN_RETURN_IF_ERR(_z_reply_copy(&pen_rep->_reply, &reply), _z_session_mutex_unlock(zn));
_Z_CLEAN_RETURN_IF_ERR(_z_reply_move(&pen_rep->_reply, &reply), _z_reply_clear(&reply);
_z_session_mutex_unlock(zn));
}
pen_rep->_tstamp = _z_timestamp_duplicate(&msg->_commons._timestamp);
pen_qry->_pending_replies = _z_pending_reply_list_push(pen_qry->_pending_replies, pen_rep);
Expand All @@ -179,6 +183,7 @@ static z_result_t _z_trigger_query_reply_partial_inner(_z_session_t *zn, const _
if (pen_qry->_consolidation != Z_CONSOLIDATION_MODE_LATEST) {
pen_qry->_callback(&reply, pen_qry->_arg);
}
_z_reply_clear(&reply);
return _Z_RES_OK;
}

Expand Down

0 comments on commit 36ad031

Please sign in to comment.