SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lcr_shutdown);
SWITCH_MODULE_DEFINITION(mod_lcr, mod_lcr_load, mod_lcr_shutdown, NULL);
+static void lcr_destroy(lcr_route route)
+{
+ while(route) {
+ switch_event_destroy(&route->fields);
+ route=route->next;
+ }
+}
+
static const char *do_cid(switch_memory_pool_t *pool, const char *cid, const char *number, switch_core_session_t *session)
{
switch_regex_t *re = NULL;
end:
- switch_event_destroy(&additional->fields);
+ /* event is freed in lcr_destroy() switch_event_destroy(&additional->fields); */
return r;
routes.lookup_number = "15555551212";
routes.cid = "18005551212";
+ lcr_destroy(routes.head);
return (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) ?
SWITCH_TRUE : SWITCH_FALSE;
}
if (mysession) {
switch_core_session_rwunlock(mysession);
}
+ lcr_destroy(routes.head);
switch_core_destroy_memory_pool(&pool);
switch_safe_free(dest);
}
end:
+ lcr_destroy(routes.head);
if (event) {
switch_event_destroy(&event);
}
}
end:
+ lcr_destroy(routes.head);
if (routes.event) {
switch_event_destroy(&event);
}
}
end:
+ lcr_destroy(cb_struct.head);
if (!session) {
if (pool) {
switch_core_destroy_memory_pool(&pool);