From 51fe96281cf777c626d3d05a244b3e76f66b86eb Mon Sep 17 00:00:00 2001 From: Rupa Schomaker Date: Tue, 22 Nov 2011 16:10:21 -0600 Subject: [PATCH] FS-3676 --resolve mod_lcr - convert assert to log and fix check condition --- src/mod/applications/mod_lcr/mod_lcr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index 41c9d0f85b..3c5062ed6f 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -626,6 +626,8 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa if (!argv[i] || zstr(argv[i])) { /* maybe we want to consider saying which carriers have null rate fields... maybe they can run the query and find out */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "rate field is null, skipping\n"); + /* kill prev/next pointers */ + /* additional->prev = NULL; */ goto end; } additional->rate = (float)atof(switch_str_nil(argv[i])); @@ -750,8 +752,16 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa /* lcr was not added to any lists, so destroy lcr object here */ if (lcr_skipped == SWITCH_TRUE) { - /* ensure we didn't accidentally add additional to the list */ - switch_assert(additional->prev == NULL && current->next != additional); + /* complain loudly if we're asked to destroy a route that is + added to the route list */ + if (additional && additional->prev != NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "additional->prev != NULL\n"); + } + if (current && current->next == additional) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "current->next == additional\n"); + } lcr_destroy(additional); }