[Freeswitch-svn] [commit] r10413 - freeswitch/trunk/src/mod/languages/mod_spidermonkey

FreeSWITCH SVN anthm at freeswitch.org
Fri Nov 14 17:30:15 PST 2008


Author: anthm
Date: Fri Nov 14 20:30:15 2008
New Revision: 10413

Log:
fix bug in apiExecute

Modified:
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Fri Nov 14 20:30:15 2008
@@ -3317,7 +3317,6 @@
 		char *arg = NULL;
 		switch_core_session_t *session = NULL;
 		switch_stream_handle_t stream = { 0 };
-		char retbuf[2048] = "";
 
 		if (!strcasecmp(cmd, "jsapi")) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid API Call!\n");
@@ -3339,13 +3338,12 @@
 			}
 		}
 
-		stream.data = retbuf;
-		stream.end = stream.data;
-		stream.data_size = sizeof(retbuf);
-		stream.write_function = switch_console_stream_write;
+		SWITCH_STANDARD_STREAM(stream);
 		switch_api_execute(cmd, arg, session, &stream);
 
-		*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, retbuf));
+		*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_str_nil((char *)stream.data)));
+		switch_safe_free(stream.data);
+
 	} else {
 		*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, ""));
 	}



More information about the Freeswitch-svn mailing list