Fixed rpc/conn.c m0_rpc_conn_ha_timer_start() memory leak
Expanded cases covered by commit:
Problem:
m0_rpc_conn_ha_timer_stop() was finalizing the timer only in the case
when the timer was not armed.
Solution:
Finalize the timer after the armed timer is stopped using m0_sm_timer_cancel()
@@ -1454,7 +1454,8 @@ M0_INTERNAL void m0_rpc_conn_ha_timer_stop(struct m0_rpc_conn *conn)
if (m0_sm_timer_is_armed(&conn->c_ha_timer)) {
M0_LOG(M0_DEBUG, "Cancelling HA timer; rpc conn=%p", conn);
m0_sm_timer_cancel(&conn->c_ha_timer);
- } else if (M0_IN(conn->c_ha_timer.tr_timer.t_state,
+ }
+ if (M0_IN(conn->c_ha_timer.tr_timer.t_state,
(M0_TIMER_STOPPED, M0_TIMER_INITED)))
m0_sm_timer_fini(&conn->c_ha_timer);
}
