Fix RS bugs.  We were holding a pointer to the script text from the java vm. Move freeing of objects to before context teardown to allow allocations to clean up their data.
diff --git a/rsScriptC.cpp b/rsScriptC.cpp
index 9da7766..073d98b 100644
--- a/rsScriptC.cpp
+++ b/rsScriptC.cpp
@@ -46,6 +46,8 @@
     if (mAccScript) {
         accDeleteScript(mAccScript);
     }
+    free(mEnviroment.mScriptText);
+    mEnviroment.mScriptText = NULL;
 }
 
 void ScriptC::setupScript()
@@ -404,7 +406,11 @@
 void rsi_ScriptCSetText(Context *rsc, const char *text, uint32_t len)
 {
     ScriptCState *ss = &rsc->mScriptC;
-    ss->mScript->mEnviroment.mScriptText = text;
+
+    char *t = (char *)malloc(len + 1);
+    memcpy(t, text, len);
+    t[len] = 0;
+    ss->mScript->mEnviroment.mScriptText = t;
     ss->mScript->mEnviroment.mScriptTextLength = len;
 }