Skip to content

Commit

Permalink
Free stored SIP reason when replacing it (see #3210)
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed May 9, 2023
1 parent abad2a6 commit 61f7a40
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/plugins/janus_sip.c
Expand Up @@ -6286,17 +6286,20 @@ void janus_sip_sofia_callback(nua_event_t event, int status, char const *phrase,
}

void janus_sip_save_reason(sip_t const *sip, janus_sip_session *session) {
if (!sip || !session)
if(!sip || !session)
return;

if (sip->sip_reason && sip->sip_reason->re_text) {
if(sip->sip_reason && sip->sip_reason->re_text) {
g_free(session->hangup_reason_header);
session->hangup_reason_header = g_strdup(sip->sip_reason->re_text);
janus_sip_remove_quotes(session->hangup_reason_header);
}
if (sip->sip_reason && sip->sip_reason->re_protocol) {
if(sip->sip_reason && sip->sip_reason->re_protocol) {
g_free(session->hangup_reason_header_protocol);
session->hangup_reason_header_protocol = g_strdup(sip->sip_reason->re_protocol);
}
if (sip->sip_reason && sip->sip_reason->re_cause) {
if(sip->sip_reason && sip->sip_reason->re_cause) {
g_free(session->hangup_reason_header_cause);
session->hangup_reason_header_cause = g_strdup(sip->sip_reason->re_cause);
}
}
Expand Down

0 comments on commit 61f7a40

Please sign in to comment.