[svn-commits] mmichelson: branch group/CCSS r237918 - /team/group/CCSS/main/ccss.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jan 5 16:42:15 CST 2010


Author: mmichelson
Date: Tue Jan  5 16:42:12 2010
New Revision: 237918

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=237918
Log:
Fix a potential memory leak. Thanks to Richard for pointing it out.


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=237918&r1=237917&r2=237918
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Tue Jan  5 16:42:12 2010
@@ -3098,14 +3098,14 @@
 int ast_cc_monitor_failed(int core_id, const char *const monitor_name, const char * const monitor_type)
 {
 	struct ast_cc_monitor *monitor = find_monitor(monitor_name, monitor_type);
-	struct cc_monitor_failure_data *failure_data = ast_calloc(1, sizeof(*failure_data));
+	struct cc_monitor_failure_data *failure_data;
 
 	if (!monitor) {
 		ast_log(LOG_WARNING, "Couldn't find a monitor with name %s and type %s\n", monitor_name, monitor_type);
 		return -1;
 	}
 
-	if (!failure_data) {
+	if (!(failure_data = ast_calloc(1, sizeof(*failure_data)))) {
 		cc_unref(monitor, "Failed to allocate failure data, unref monitor that we found");
 		return -1;
 	}




More information about the svn-commits mailing list