mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-07 22:03:50 +00:00
FS-12010: [sofia-sip] Fix improper cleanup on su_deinit().
This commit is contained in:
parent
96aac32237
commit
f93445a38c
@ -1 +1 @@
|
|||||||
Tue Aug 13 10:50:57 CDT 2019
|
Mon Aug 19 16:25:57 CDT 2019
|
||||||
|
@ -64,6 +64,7 @@ char const sip_version_2_0[] = "SIP/2.0";
|
|||||||
extern msg_mclass_t sip_mclass[];
|
extern msg_mclass_t sip_mclass[];
|
||||||
|
|
||||||
static msg_mclass_t const *_default = sip_mclass;
|
static msg_mclass_t const *_default = sip_mclass;
|
||||||
|
static msg_mclass_t *_default_parser_cloned = NULL;
|
||||||
|
|
||||||
/** Return a built-in SIP parser object. */
|
/** Return a built-in SIP parser object. */
|
||||||
msg_mclass_t const *sip_default_mclass(void)
|
msg_mclass_t const *sip_default_mclass(void)
|
||||||
@ -71,6 +72,15 @@ msg_mclass_t const *sip_default_mclass(void)
|
|||||||
return _default;
|
return _default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Release SIP parser object if it was cloned. */
|
||||||
|
void sip_cloned_parser_destroy(void)
|
||||||
|
{
|
||||||
|
if (_default_parser_cloned) {
|
||||||
|
free(_default_parser_cloned);
|
||||||
|
_default_parser_cloned = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Update the default SIP parser.
|
/** Update the default SIP parser.
|
||||||
*
|
*
|
||||||
* Use the extended SIP parser as default one.
|
* Use the extended SIP parser as default one.
|
||||||
@ -128,10 +138,12 @@ msg_mclass_t *sip_extend_mclass(msg_mclass_t *input)
|
|||||||
{
|
{
|
||||||
msg_mclass_t *mclass;
|
msg_mclass_t *mclass;
|
||||||
|
|
||||||
if (input == NULL || input == _default)
|
if (input == NULL || input == _default) {
|
||||||
mclass = msg_mclass_clone(_default, 0, 0);
|
_default_parser_cloned = msg_mclass_clone(_default, 0, 0);
|
||||||
else
|
mclass = _default_parser_cloned;
|
||||||
|
} else {
|
||||||
mclass = input;
|
mclass = input;
|
||||||
|
}
|
||||||
|
|
||||||
if (mclass) {
|
if (mclass) {
|
||||||
extern msg_hclass_t * const sip_extensions[];
|
extern msg_hclass_t * const sip_extensions[];
|
||||||
@ -143,8 +155,10 @@ msg_mclass_t *sip_extend_mclass(msg_mclass_t *input)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (msg_mclass_insert_header(mclass, hclass, 0) < 0) {
|
if (msg_mclass_insert_header(mclass, hclass, 0) < 0) {
|
||||||
if (input != mclass)
|
if (input != mclass) {
|
||||||
free(mclass);
|
free(mclass);
|
||||||
|
_default_parser_cloned = NULL;
|
||||||
|
}
|
||||||
return mclass = NULL;
|
return mclass = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,9 @@ SOFIA_BEGIN_DECLS
|
|||||||
/** Return a built-in SIP parser object. */
|
/** Return a built-in SIP parser object. */
|
||||||
SOFIAPUBFUN msg_mclass_t const *sip_default_mclass(void);
|
SOFIAPUBFUN msg_mclass_t const *sip_default_mclass(void);
|
||||||
|
|
||||||
|
/** Release SIP parser object if it was cloned. */
|
||||||
|
SOFIAPUBFUN void sip_cloned_parser_destroy(void);
|
||||||
|
|
||||||
SOFIAPUBFUN int sip_update_default_mclass(msg_mclass_t const *mclass);
|
SOFIAPUBFUN int sip_update_default_mclass(msg_mclass_t const *mclass);
|
||||||
SOFIAPUBFUN msg_mclass_t *sip_extend_mclass(msg_mclass_t *input);
|
SOFIAPUBFUN msg_mclass_t *sip_extend_mclass(msg_mclass_t *input);
|
||||||
|
|
||||||
|
@ -6477,7 +6477,7 @@ void mod_sofia_shutdown_cleanup() {
|
|||||||
Release the clone of the default SIP parser
|
Release the clone of the default SIP parser
|
||||||
created by `sip_update_default_mclass(sip_extend_mclass(NULL))` call with NULL argument
|
created by `sip_update_default_mclass(sip_extend_mclass(NULL))` call with NULL argument
|
||||||
*/
|
*/
|
||||||
free(sip_default_mclass());
|
sip_cloned_parser_destroy();
|
||||||
|
|
||||||
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||||
switch_core_hash_destroy(&mod_sofia_globals.profile_hash);
|
switch_core_hash_destroy(&mod_sofia_globals.profile_hash);
|
||||||
|
@ -4290,6 +4290,7 @@ switch_status_t sofia_init(void)
|
|||||||
su_init();
|
su_init();
|
||||||
if (sip_update_default_mclass(sip_extend_mclass(NULL)) < 0) {
|
if (sip_update_default_mclass(sip_extend_mclass(NULL)) < 0) {
|
||||||
su_deinit();
|
su_deinit();
|
||||||
|
sip_cloned_parser_destroy();
|
||||||
return SWITCH_STATUS_GENERR;
|
return SWITCH_STATUS_GENERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user