/hg/icedtea-web: Small fixes to C++ side of plugin, submitted by...

adomurad at icedtea.classpath.org adomurad at icedtea.classpath.org
Mon Jul 9 11:58:22 PDT 2012


changeset 0e3c3f0aeb1f in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=0e3c3f0aeb1f
author: Adam Domurad <adomurad at redhat.com>
date: Mon Jul 09 14:50:22 2012 -0400

	Small fixes to C++ side of plugin, submitted by Martin Olsson.
	Also fixed a space in my last ChangeLog.


diffstat:

 ChangeLog                                         |  12 +++++++++++-
 plugin/icedteanp/IcedTeaNPPlugin.cc               |   4 ++--
 plugin/icedteanp/IcedTeaPluginRequestProcessor.cc |   4 ++--
 plugin/icedteanp/IcedTeaPluginUtils.cc            |  11 ++++++-----
 4 files changed, 21 insertions(+), 10 deletions(-)

diffs (90 lines):

diff -r af6e50d03455 -r 0e3c3f0aeb1f ChangeLog
--- 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 at redhat.com>
+2012-07-09  Martin Olsson  <martin at 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 at redhat.com>
 
 	Ignore invalid jar files in applets, like the oracle plugin does.
 	* netx/net/sourceforge/jnlp/cache/IllegalResourceDescriptorException.java:
diff -r af6e50d03455 -r 0e3c3f0aeb1f plugin/icedteanp/IcedTeaNPPlugin.cc
--- 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;
diff -r af6e50d03455 -r 0e3c3f0aeb1f plugin/icedteanp/IcedTeaPluginRequestProcessor.cc
--- 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);
diff -r af6e50d03455 -r 0e3c3f0aeb1f plugin/icedteanp/IcedTeaPluginUtils.cc
--- 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;
 }



More information about the distro-pkg-dev mailing list