[asterisk-commits] res musiconhold.c: Fix format ref leak when parsing MOH conf... (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 26 13:21:55 CST 2017


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/4786 )

Change subject: res_musiconhold.c: Fix format ref leak when parsing MOH config class.
......................................................................


res_musiconhold.c: Fix format ref leak when parsing MOH config class.

Change-Id: Ica8e8e2ce7604c2c61ec55bef07dc675361d2ea5
---
M res/res_musiconhold.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, but someone else must approve
  Corey Farrell: Looks good to me, but someone else must approve



diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 6f51820..6b0f00a 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1433,6 +1433,7 @@
 				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 @@
 			} 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);

-- 
To view, visit https://gerrit.asterisk.org/4786
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ica8e8e2ce7604c2c61ec55bef07dc675361d2ea5
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-commits mailing list