]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
MODLANG-111
authorBrian West <brian@freeswitch.org>
Thu, 14 May 2009 01:36:32 +0000 (01:36 +0000)
committerBrian West <brian@freeswitch.org>
Thu, 14 May 2009 01:36:32 +0000 (01:36 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13297 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/languages/mod_lua/mod_lua.cpp

index 5034babc7a9acd3fd2a51d74d1e3050bb599afb8..c28f134ec744febc7acfe89abd0233a9eec4b9ae 100644 (file)
@@ -213,7 +213,7 @@ static switch_xml_t lua_fetch(const char *section,
        if (!switch_strlen_zero(globals.xml_handler)) {
                lua_State *L = lua_init();
                char *mycmd = strdup(globals.xml_handler);
-               const char *str;
+               char *str;
 
                switch_assert(mycmd);
 
@@ -240,8 +240,8 @@ static switch_xml_t lua_fetch(const char *section,
                lua_parse_and_execute(L, mycmd);
 
                lua_getfield(L, LUA_GLOBALSINDEX, "XML_STRING");
-               str = lua_tostring(L, 1);
-
+               str = strdup( lua_tostring(L, 1) );
+               
                if (str) {
                        if (switch_strlen_zero(str)) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
@@ -252,6 +252,7 @@ static switch_xml_t lua_fetch(const char *section,
 
                lua_uninit(L);
                free(mycmd);
+               free(str);
        }
 
        return xml;