mirror of
https://github.com/open5gs/open5gs.git
synced 2026-04-28 03:19:31 +00:00
[DIAM] Fix the crash when terminating Diameter
When exiting a diameter interface, the session state data could be NULL. So we added code to check the session state data to prevent SIGSEGV occurring.
This commit is contained in:
parent
a9a60135f9
commit
8d2d037314
11 changed files with 52 additions and 3 deletions
|
|
@ -49,6 +49,11 @@ struct sess_state {
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_free(sess_data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ static void mme_s6a_pua_cb(void *data, struct msg **msg);
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
ogs_free(sess_data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,10 @@ static struct rx_sess_state *find_rx_state(struct sess_state *gx, os0_t sid)
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
ogs_assert(sess_data);
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess_data->peer_host)
|
||||
ogs_free(sess_data->peer_host);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,10 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
ogs_assert(sess_data);
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess_data->rx_sid)
|
||||
ogs_free((char *)sess_data->rx_sid);
|
||||
|
|
|
|||
|
|
@ -76,6 +76,11 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess_data->gx_sid)
|
||||
ogs_free(sess_data->gx_sid);
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,11 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess_data->gy_sid)
|
||||
ogs_free(sess_data->gy_sid);
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,11 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess_data->s6b_sid)
|
||||
ogs_free(sess_data->s6b_sid);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,10 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
ogs_assert(sess_data);
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess_data->sid)
|
||||
ogs_free(sess_data->sid);
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ static void test_swx_saa_cb(void *data, struct msg **msg);
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess_data->user_name)
|
||||
ogs_free(sess_data->user_name);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@ static void test_cx_lia_cb(void *data, struct msg **msg);
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess_data->user_name)
|
||||
ogs_free(sess_data->user_name);
|
||||
if (sess_data->public_identity)
|
||||
|
|
|
|||
|
|
@ -51,6 +51,11 @@ static __inline__ struct sess_state *new_state(os0_t sid)
|
|||
|
||||
static void state_cleanup(struct sess_state *sess_data, os0_t sid, void *opaque)
|
||||
{
|
||||
if (!sess_data) {
|
||||
ogs_error("No session state");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sess_data->sid)
|
||||
ogs_free(sess_data->sid);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue