[asterisk-commits] twilson: branch twilson/calendaring r156628 - in /team/twilson/calendaring: m...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 13 11:55:15 CST 2008


Author: twilson
Date: Thu Nov 13 11:55:14 2008
New Revision: 156628

URL: http://svn.digium.com/view/asterisk?view=rev&rev=156628
Log:
Add fixes from reviewboard and remove a debugging line

Modified:
    team/twilson/calendaring/main/calendar.c
    team/twilson/calendaring/res/res_caldav.c

Modified: team/twilson/calendaring/main/calendar.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/main/calendar.c?view=diff&rev=156628&r1=156627&r2=156628
==============================================================================
--- team/twilson/calendaring/main/calendar.c (original)
+++ team/twilson/calendaring/main/calendar.c Thu Nov 13 11:55:14 2008
@@ -219,19 +219,21 @@
 
 
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&techs, caltech_list, list) {
-		if (caltech_list->tech == tech) {
-			i = ao2_iterator_init(calendars, 0);
-			while ((cal = ao2_iterator_next(&i))) {
-				if (cal->tech == tech) {
-					ao2_unlink(calendars, cal);
-					cal = unref_calendar(cal);
-				}
-			}
-
-			AST_LIST_REMOVE_CURRENT(list);
-			ast_verb(2, "Unregistered calendar type '%s'\n", tech->type);
-			break;
-		}
+		if (caltech_list->tech != tech) {
+			continue;
+		}
+
+		i = ao2_iterator_init(calendars, 0);
+		while ((cal = ao2_iterator_next(&i))) {
+			if (cal->tech == tech) {
+				ao2_unlink(calendars, cal);
+				cal = unref_calendar(cal);
+			}
+		}
+
+		AST_LIST_REMOVE_CURRENT(list);
+		ast_verb(2, "Unregistered calendar type '%s'\n", tech->type);
+		break;
 	}
 	AST_LIST_TRAVERSE_SAFE_END;
 
@@ -308,6 +310,7 @@
 
 	if (ast_string_field_init(event, 32)) {
 		ast_log(LOG_ERROR, "Could not allocate memory for event fields\n");
+		event = ast_calendar_unref_event(event);
 		return NULL;
 	}
 
@@ -565,6 +568,7 @@
 		if (!strcasecmp(cat, "general")) {
 			if (!(val = ast_variable_retrieve(cfg, cat, "enabled")) || !ast_true(val)) {
 				ast_debug(1, "Disabling calendar support\n");
+				ast_config_destroy(cfg);
 				return 0;
 			} else {
 				ast_debug(1, "Enabling calendar support\n");
@@ -584,16 +588,21 @@
 
 			if (!(cal = ao2_alloc(sizeof(*cal), calendar_destructor))) {
 				ast_log(LOG_ERROR, "Could not allocate calendar structure. Stopping.\n");
+				ast_config_destroy(cfg);
 				return -1;
 			}
 
 			if (!(cal->events = ao2_container_alloc(MAX_BUCKETS, event_hash_fn, event_cmp_fn))) {
 				ast_log(LOG_ERROR, "Could not allocate events container for %s\n", cat);
+				cal = unref_calendar(cal);
+				ast_config_destroy(cfg);
+				return -1;
 			}
 
 			if (ast_string_field_init(cal, 32)) {
 				ast_log(LOG_ERROR, "Couldn't create string fields for %s\n", cat);
 				cal = unref_calendar(cal);
+				ast_config_destroy(cfg);
 				return -1;
 			}
 
@@ -633,6 +642,7 @@
 			if (!(load_data = ast_malloc(sizeof(*load_data)))) {
 				ast_log(LOG_ERROR, "Could not allocate memory for two measly pointers? Right...\n");
 				cal = unref_calendar(cal);
+				ast_config_destroy(cfg);
 				return -1;
 			}
 			load_data->cfg = cfg;
@@ -644,6 +654,8 @@
 			cal = unref_calendar(cal);
 		}
 	}
+
+	ast_config_destroy(cfg);
 
 	return 0;
 }

Modified: team/twilson/calendaring/res/res_caldav.c
URL: http://svn.digium.com/view/asterisk/team/twilson/calendaring/res/res_caldav.c?view=diff&rev=156628&r1=156627&r2=156628
==============================================================================
--- team/twilson/calendaring/res/res_caldav.c (original)
+++ team/twilson/calendaring/res/res_caldav.c Thu Nov 13 11:55:14 2008
@@ -251,7 +251,6 @@
 	icalcomponent_add_component(calendar, icalevent);
 
 	ast_str_append(&body, 0, "%s", icalcomponent_as_ical_string(calendar));
-	ast_verb(0, "\n\n%s\n\n", body->str);
 	ast_str_set(&subdir, 0, "%s%s.ics", body->str[body->used] == '/' ? "" : "/", event->uid);
 
 	response = caldav_request(event->owner->tech_pvt, "PUT", body, subdir, "text/calendar");




More information about the asterisk-commits mailing list