mod_lcr: fix memory leak

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11532 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-01-28 01:50:45 +00:00
parent 9a6356286c
commit e27efe769e
1 changed files with 12 additions and 14 deletions

View File

@ -280,6 +280,14 @@ int route_add_callback(void *pArg, int argc, char **argv, char **columnNames)
cbt->matches++; cbt->matches++;
if (switch_strlen_zero(argv[LCR_GW_PREFIX_PLACE]) && switch_strlen_zero(argv[LCR_GW_SUFFIX_PLACE]) ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"There's no way to dial this Gateway: Carrier: \"%s\" Prefix: \"%s\", Suffix \"%s\"\n",
switch_str_nil(argv[LCR_CARRIER_PLACE]),
switch_str_nil(argv[LCR_GW_PREFIX_PLACE]), switch_str_nil(argv[LCR_GW_SUFFIX_PLACE]));
return SWITCH_STATUS_SUCCESS;
}
switch_zmalloc(additional, sizeof(lcr_obj_t)); switch_zmalloc(additional, sizeof(lcr_obj_t));
additional->digit_len = strlen(argv[LCR_DIGITS_PLACE]); additional->digit_len = strlen(argv[LCR_DIGITS_PLACE]);
@ -304,21 +312,11 @@ int route_add_callback(void *pArg, int argc, char **argv, char **columnNames)
} }
for (current = cbt->head; current; current = current->next) { for (current = cbt->head; current; current = current->next) {
if (switch_strlen_zero(additional->gw_prefix) && switch_strlen_zero(additional->gw_suffix) ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING
, "WTF?!? There's no way to dial this Gateway: Carrier: \"%s\" Prefix: \"%s\", Suffix \"%s\"\n"
, additional->carrier_name
, additional->gw_prefix, additional->gw_suffix
);
break;
}
if (!strcmp(current->gw_prefix, additional->gw_prefix) && !strcmp(current->gw_suffix, additional->gw_suffix)) { if (!strcmp(current->gw_prefix, additional->gw_prefix) && !strcmp(current->gw_suffix, additional->gw_suffix)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
, "Ignoring Duplicate route for termination point (%s:%s)\n" "Ignoring Duplicate route for termination point (%s:%s)\n",
, additional->gw_prefix, additional->gw_suffix additional->gw_prefix, additional->gw_suffix);
);
switch_safe_free(additional); switch_safe_free(additional);
break; break;
} }
@ -488,7 +486,7 @@ static switch_status_t lcr_load_config()
profile->order_by = ", rate"; profile->order_by = ", rate";
} }
if(!switch_strlen_zero(id_s)) { if(!switch_strlen_zero(id_s)) {
profile->id = atoi(id_s); profile->id = (uint16_t)atoi(id_s);
} }
switch_core_hash_insert(globals.profile_hash, profile->name, profile); switch_core_hash_insert(globals.profile_hash, profile->name, profile);