summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2017-01-10 12:30:57 -0600
committerRichard Mudgett <rmudgett@digium.com>2017-01-24 13:40:11 -0600
commit38a2021c68df5352f601439c7317cac5082d10a8 (patch)
tree579e2a337d223741b21a4c1fcedfa9974304c88b
parent48178e5918967337624a7e43ff1d84a7bb63fa85 (diff)
res_musiconhold.c: Fix format ref leak when parsing MOH config class.
Change-Id: Ica8e8e2ce7604c2c61ec55bef07dc675361d2ea5
-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);