summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2017-01-26 13:21:55 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-01-26 13:21:55 -0600
commit1a81ba335b7f0ce80bfe9b8a53bf87cf0b11c1c6 (patch)
tree744764b998d00774c8e8601b7e3983d4147a3e86 /res
parent616e98ce0a38bf633adc436e7e75e76671c85cd0 (diff)
parent38a2021c68df5352f601439c7317cac5082d10a8 (diff)
Merge "res_musiconhold.c: Fix format ref leak when parsing MOH config class." into 13
Diffstat (limited to 'res')
-rw-r--r--res/res_musiconhold.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 6f5182072..6b0f00abf 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -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);