[Freeswitch-svn] [commit] r13297 - freeswitch/trunk/src/mod/languages/mod_lua

FreeSWITCH SVN brian at freeswitch.org
Wed May 13 18:36:32 PDT 2009


Author: brian
Date: Wed May 13 20:36:32 2009
New Revision: 13297

Log:
 MODLANG-111

Modified:
   freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp

Modified: freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp	(original)
+++ freeswitch/trunk/src/mod/languages/mod_lua/mod_lua.cpp	Wed May 13 20:36:32 2009
@@ -213,7 +213,7 @@
 	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 @@
 		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 @@
 
 		lua_uninit(L);
 		free(mycmd);
+		free(str);
 	}
 
 	return xml;



More information about the Freeswitch-svn mailing list