changeset 463:0e3c3f0aeb1f

Small fixes to C++ side of plugin, submitted by Martin Olsson. Also fixed a space in my last ChangeLog.
author Adam Domurad <adomurad@redhat.com>
date Mon, 09 Jul 2012 14:50:22 -0400
parents af6e50d03455
children 13ca1c870b92
files ChangeLog plugin/icedteanp/IcedTeaNPPlugin.cc plugin/icedteanp/IcedTeaPluginRequestProcessor.cc plugin/icedteanp/IcedTeaPluginUtils.cc
diffstat 4 files changed, 21 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 09 14:08:30 2012 -0400
+++ b/ChangeLog	Mon Jul 09 14:50:22 2012 -0400
@@ -1,4 +1,14 @@
-2012-07-09  Adam Domurad <adomurad@redhat.com>
+2012-07-09  Martin Olsson  <martin@minimum.se>
+
+	* plugin/icedteanp/IcedTeaPluginUtils.cc: Change calls from g_free
+	to free when allocated with calloc.
+	* plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
+	(PluginRequestProcessor::call): Make sure args_array doesnt hold 
+	garbage when freed.
+	(_loadURL): Change calls from g_free to free when allocated with 
+	calloc.
+
+2012-07-09  Adam Domurad  <adomurad@redhat.com>
 
 	Ignore invalid jar files in applets, like the oracle plugin does.
 	* netx/net/sourceforge/jnlp/cache/IllegalResourceDescriptorException.java:
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Mon Jul 09 14:08:30 2012 -0400
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Mon Jul 09 14:50:22 2012 -0400
@@ -1272,7 +1272,7 @@
         PLUGIN_DEBUG("Proxy info: %s\n", proxy_info);
         plugin_send_message_to_appletviewer(proxy_info);
 
-        g_free(decoded_url);
+        free(decoded_url);
         decoded_url = NULL;
         g_free(proxy_info);
         proxy_info = NULL;
@@ -1298,7 +1298,7 @@
         PLUGIN_DEBUG("Cookie info: %s\n", cookie_info);
         plugin_send_message_to_appletviewer(cookie_info);
 
-        g_free(decoded_url);
+        free(decoded_url);
         decoded_url = NULL;
         g_free(cookie_info);
         cookie_info = NULL;
--- a/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc	Mon Jul 09 14:08:30 2012 -0400
+++ b/plugin/icedteanp/IcedTeaPluginRequestProcessor.cc	Mon Jul 09 14:50:22 2012 -0400
@@ -275,7 +275,7 @@
     JavaResultData* java_result;
     NPVariant* result_variant;
     std::string result_variant_jniid = std::string();
-    NPVariant* args_array;
+    NPVariant* args_array = NULL;
     AsyncCallThreadData thread_data = AsyncCallThreadData();
 
     reference = atoi(message_parts->at(3)->c_str());
@@ -994,7 +994,7 @@
 
     ((AsyncCallThreadData*) data)->result_ready = true;
 
-    g_free(decoded_url);
+    free(decoded_url);
     decoded_url = NULL;
 
     PLUGIN_DEBUG("_loadURL returning %d\n", ((AsyncCallThreadData*) data)->call_successful);
--- a/plugin/icedteanp/IcedTeaPluginUtils.cc	Mon Jul 09 14:08:30 2012 -0400
+++ b/plugin/icedteanp/IcedTeaPluginUtils.cc	Mon Jul 09 14:50:22 2012 -0400
@@ -297,7 +297,7 @@
 	v->reserve(strlen(str)/2);
 	char* copy;
 
-	// Tokening is done on a copy
+	// Tokenization is done on a copy
 	copy = (char*) malloc (sizeof(char)*strlen(str) + 1);
 	strcpy(copy, str);
 
@@ -308,11 +308,12 @@
 	{
 	    // Allocation on heap since caller has no way to knowing how much will
 	    // be needed. Make sure caller cleans up!
-		std::string* s = new std::string();
-		s->append(tok_ptr);
-		v->push_back(s);
-		tok_ptr = strtok (NULL, " ");
+	    std::string* s = new std::string();
+	    s->append(tok_ptr);
+	    v->push_back(s);
+	    tok_ptr = strtok (NULL, " ");
 	}
+        free(copy);
 
 	return v;
 }