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

FreeSWITCH SVN rupa at freeswitch.org
Fri Feb 20 14:00:24 PST 2009


Author: rupa
Date: Fri Feb 20 16:00:24 2009
New Revision: 12204

Log:
handle case where custom_sql is braindead (no replaceable params)


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	Fri Feb 20 16:00:24 2009
@@ -321,8 +321,8 @@
 /* format the custom sql */
 static char *format_custom_sql(const char *custom_sql, callback_t *cb_struct, const char *digits)
 {
-	char * tmpSQL;
-	char * newSQL;
+	char * tmpSQL = NULL;
+	char * newSQL = NULL;
 	switch_channel_t *channel;
 	
 	/* first replace %s with digits to maintain backward compat */
@@ -352,7 +352,12 @@
 	if(tmpSQL != newSQL) {
 		switch_safe_free(tmpSQL);
 	}
-	return newSQL;
+	
+	if(newSQL == NULL) {
+		return (char *) custom_sql;
+	} else {
+		return newSQL;
+	}
 }
 
 static switch_bool_t lcr_execute_sql_callback(char *sql, switch_core_db_callback_func_t callback, void *pdata)



More information about the Freeswitch-svn mailing list