mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-02 02:18:31 +00:00
res_musiconhold.c: Fix format ref leak when parsing MOH config class.
Change-Id: Ica8e8e2ce7604c2c61ec55bef07dc675361d2ea5
This commit is contained in:
@@ -1433,6 +1433,7 @@ static int local_ast_moh_start(struct ast_channel *chan, const char *mclass, con
|
||||
else if (!strcasecmp(tmp->name, "sort") && !strcasecmp(tmp->value, "alpha"))
|
||||
ast_set_flag(mohclass, MOH_SORTALPHA);
|
||||
else if (!strcasecmp(tmp->name, "format")) {
|
||||
ao2_cleanup(mohclass->format);
|
||||
mohclass->format = ast_format_cache_get(tmp->value);
|
||||
if (!mohclass->format) {
|
||||
ast_log(LOG_WARNING, "Unknown format '%s' -- defaulting to SLIN\n", tmp->value);
|
||||
@@ -1765,6 +1766,7 @@ static int load_moh_classes(int reload)
|
||||
} else if (!strcasecmp(var->name, "sort") && !strcasecmp(var->value, "alpha")) {
|
||||
ast_set_flag(class, MOH_SORTALPHA);
|
||||
} else if (!strcasecmp(var->name, "format")) {
|
||||
ao2_cleanup(class->format);
|
||||
class->format = ast_format_cache_get(var->value);
|
||||
if (!class->format) {
|
||||
ast_log(LOG_WARNING, "Unknown format '%s' -- defaulting to SLIN\n", var->value);
|
||||
|
Reference in New Issue
Block a user