summaryrefslogtreecommitdiff
path: root/res/res_musiconhold.c
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:56:12 -0600
commit56854f22d2509edbd0dfbae592480ff618c79a7b (patch)
treec3355e5a07c4724c9f6ef68419534c803d656541 /res/res_musiconhold.c
parentf517c015e244f54a94a10b419163425c8131d497 (diff)
res_musiconhold.c: Fix format ref leak when parsing MOH config class.
Change-Id: Ica8e8e2ce7604c2c61ec55bef07dc675361d2ea5
Diffstat (limited to 'res/res_musiconhold.c')
-rw-r--r--res/res_musiconhold.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 3a751ecce..70bb04018 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1058,13 +1058,14 @@ static void moh_parse_options(struct ast_variable *var, struct mohclass *mohclas
ast_set_flag(mohclass, MOH_RANDSTART);
}
} else if (!strcasecmp(var->name, "format")) {
+ ao2_cleanup(mohclass->format);
mohclass->format = ast_format_cache_get(var->value);
if (!mohclass->format) {
ast_log(LOG_WARNING, "Unknown format '%s' -- defaulting to SLIN\n", var->value);
mohclass->format = ao2_bump(ast_format_slin);
}
- }
- }
+ }
+ }
}
static int moh_add_file(struct mohclass *class, const char *filepath)