Often I struggle to understand memory allocations and the "weird" things
of C, so please point out to me what I'm missing here (I must be wrong,
because you guys would not miss this, right?
cleared_ci = (struct osmo_mgcpc_ep_ci){
.ep = ep,
.mgcp_client_fi = ci->mgcp_client_fi,
.got_port_info = ci->got_port_info,
.rtp_info = ci->rtp_info,
.occupied = true,
/* .pending = true follows below */
.verb = verb,
.notify = {
.fi = notify,
.success = event_success,
.failure = event_failure,
.data = notify_data,
}
};
osmo_strlcpy(cleared_ci.label, ci->label, sizeof(cleared_ci.label));
osmo_strlcpy(cleared_ci.mgcp_ci_str, ci->mgcp_ci_str,
sizeof(cleared_ci.mgcp_ci_str));
*ci = cleared_ci;
LOG_CI_VERB(ci, LOGL_DEBUG, "notify=%s\n",
osmo_fsm_inst_name(ci->notify.fi));
#define LOG_CI_VERB(ci, level, fmt, args...) do { \
if (ci->verb_info.addr[0]) \
LOG_CI(ci, level, "%s %s:%u: " fmt, \
osmo_mgcp_verb_name(ci->verb), ci->verb_info.addr,
ci->verb_info.port, \
## args); \
else \
LOG_CI(ci, level, "%s: " fmt, \
osmo_mgcp_verb_name(ci->verb), \
## args); \
} while(0)
How is ci->verb_info not being using uninitialized here?
Would that explain random crashes with this code?
https://osmocom.org/issues/5572