From: Richard Mudgett Date: Tue, 10 Jan 2017 18:30:57 +0000 (-0600) Subject: res_musiconhold.c: Fix format ref leak when parsing MOH config class. X-Git-Tag: 14.3.0-rc1~25^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5713081f417b73f4eb4fc8836c6f16c76c7d94b;p=thirdparty%2Fasterisk.git res_musiconhold.c: Fix format ref leak when parsing MOH config class. Change-Id: Ica8e8e2ce7604c2c61ec55bef07dc675361d2ea5 --- diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 3c7199ef45..3bae1727e2 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -1060,13 +1060,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)