]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
handle case where custom_sql is braindead (no replaceable params)
authorRupa Schomaker <rupa@rupa.com>
Fri, 20 Feb 2009 22:00:24 +0000 (22:00 +0000)
committerRupa Schomaker <rupa@rupa.com>
Fri, 20 Feb 2009 22:00:24 +0000 (22:00 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12204 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_lcr/mod_lcr.c

index f645cf96b25da033905254f6a2da019a5f4f6589..841b82b52cc423d58892078fa84e999552d59eef 100644 (file)
@@ -321,8 +321,8 @@ static char *expand_digits(switch_memory_pool_t *pool, char *digits)
 /* 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 @@ static char *format_custom_sql(const char *custom_sql, callback_t *cb_struct, co
        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)