[Freeswitch-svn] [commit] r11532 - freeswitch/trunk/src/mod/applications/mod_lcr

FreeSWITCH SVN mikej at freeswitch.org
Tue Jan 27 17:50:45 PST 2009


Author: mikej
Date: Tue Jan 27 19:50:45 2009
New Revision: 11532

Log:
mod_lcr: fix memory leak

Modified:
   freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c

Modified: freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_lcr/mod_lcr.c	Tue Jan 27 19:50:45 2009
@@ -280,6 +280,14 @@
 	
 	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));
 
 	additional->digit_len = strlen(argv[LCR_DIGITS_PLACE]);
@@ -304,21 +312,11 @@
 	}
 
 	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)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG
-							  , "Ignoring Duplicate route for termination point (%s:%s)\n"
-							  , additional->gw_prefix, additional->gw_suffix
-							  );
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+								"Ignoring Duplicate route for termination point (%s:%s)\n",
+								additional->gw_prefix, additional->gw_suffix);
 			switch_safe_free(additional);
 			break;
 		}
@@ -488,7 +486,7 @@
 					profile->order_by = ", rate";
 				}
 				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);



More information about the Freeswitch-svn mailing list