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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 26 16:05:31 CST 2017


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/4787 )

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, 3 insertions(+), 2 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 3c7199e..3bae172 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1060,13 +1060,14 @@
 				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)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ica8e8e2ce7604c2c61ec55bef07dc675361d2ea5
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
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