[svn-commits] mmichelson: branch group/CCSS_Monitor_Restructure r242032 - /team/group/CCSS_...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Jan 21 12:49:56 CST 2010
Author: mmichelson
Date: Thu Jan 21 12:49:53 2010
New Revision: 242032
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242032
Log:
Add some more calls to the monitor-less destructor function.
Modified:
team/group/CCSS_Monitor_Restructure/main/ccss.c
Modified: team/group/CCSS_Monitor_Restructure/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/main/ccss.c?view=diff&rev=242032&r1=242031&r2=242032
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Thu Jan 21 12:49:53 2010
@@ -1280,8 +1280,14 @@
static void cc_monitor_destroy(struct cc_monitor *monitor)
{
- monitor->callbacks->cancel_available_timer2(monitor->private_data, &monitor->available_timer_id);
- monitor->callbacks->destructor2(monitor->private_data);
+ /* During the monitor creation process, it is possible for this
+ * function to be called prior to when callbacks are assigned
+ * to the monitor
+ */
+ if (monitor->callbacks) {
+ monitor->callbacks->cancel_available_timer2(monitor->private_data, &monitor->available_timer_id);
+ monitor->callbacks->destructor2(monitor->private_data);
+ }
cc_unref(monitor->interface, "Unreffing tree's reference to interface");
ast_free(monitor->dialable_name);
ast_free(monitor);
@@ -1620,28 +1626,33 @@
int parent_id = cc_data->parent_interface_id;
if (!(cc_interface = ao2_alloc(sizeof(*cc_interface) + device_name_len, cc_interface_destroy))) {
+ call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return NULL;
}
if (!(cc_interface->config_params = ast_cc_config_params_init())) {
ao2_t_ref(cc_interface, -1, "Failed to allocate config params, unref interface");
+ call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return NULL;
}
if (!(monitor = ast_calloc(1, sizeof(*monitor)))) {
ao2_t_ref(cc_interface, -1, "Failed to allocate tree item, unref interface");
+ call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return NULL;
}
if (!(monitor->dialable_name = ast_strdup(dialable_name))) {
ao2_t_ref(cc_interface, -1, "Failed to copy dialable name");
cc_monitor_destroy(monitor);
+ call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return NULL;
}
if (!(monitor->callbacks = find_monitor_callbacks(cc_data->monitor_type))) {
ao2_t_ref(cc_interface, -1, "Failed to find monitor callbacks\n");
cc_monitor_destroy(monitor);
+ call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return NULL;
}
More information about the svn-commits
mailing list