/hg/icedtea-web: Free two memory leaks

adomurad at icedtea.classpath.org adomurad at icedtea.classpath.org
Wed Nov 21 07:55:01 PST 2012


changeset b28386115aae in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=b28386115aae
author: Adam Domurad <adomurad at redhat.com>
date: Wed Nov 21 10:54:55 2012 -0500

	Free two memory leaks


diffstat:

 ChangeLog                           |   5 +++++
 plugin/icedteanp/IcedTeaNPPlugin.cc |  10 +++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diffs (62 lines):

diff -r 7205e5aa56e6 -r b28386115aae ChangeLog
--- a/ChangeLog	Tue Nov 20 13:57:25 2012 +0100
+++ b/ChangeLog	Wed Nov 21 10:54:55 2012 -0500
@@ -1,3 +1,8 @@
+2012-11-21  Adam Domurad  <adomurad at redhat.com>
+
+	* plugin/icedteanp/IcedTeaNPPlugin.cc
+	(consume_plugin_message): Free two buffers returned from NPN_GetValueForURL function.
+
 2012-11-20  Jiri Vanek <jvanek at redhat.com>
 
 	*  Makefile.am: (stamps/run-netx-dist-tests.stamp)  and
diff -r 7205e5aa56e6 -r b28386115aae plugin/icedteanp/IcedTeaNPPlugin.cc
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Tue Nov 20 13:57:25 2012 +0100
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Wed Nov 21 10:54:55 2012 -0500
@@ -1210,7 +1210,7 @@
   gchar** parts = g_strsplit (message, " ", 5);
   if (g_str_has_prefix(parts[1], "PluginProxyInfo"))
   {
-    gchar* proxy;
+    gchar* proxy = NULL;
     uint32_t len;
 
     gchar* decoded_url = (gchar*) calloc(strlen(parts[4]) + 1, sizeof(gchar));
@@ -1220,7 +1220,7 @@
     gchar* proxy_info;
 
 #if MOZILLA_VERSION_COLLAPSED < 1090100
-	proxy = (char*) malloc(sizeof(char)*2048);
+	proxy = (gchar*) g_malloc(sizeof(char)*2048);
 #endif
 
     proxy_info = g_strconcat ("plugin PluginProxyInfo reference ", parts[3], " ", NULL);
@@ -1237,10 +1237,8 @@
     g_free(proxy_info);
     proxy_info = NULL;
 
-#if MOZILLA_VERSION_COLLAPSED < 1090100
 	g_free(proxy);
 	proxy = NULL;
-#endif
 
   } else if (g_str_has_prefix(parts[1], "PluginCookieInfo"))
   {
@@ -1248,7 +1246,7 @@
     IcedTeaPluginUtilities::decodeURL(parts[4], &decoded_url);
 
     gchar* cookie_info = g_strconcat ("plugin PluginCookieInfo reference ", parts[3], " ", NULL);
-    gchar* cookie_string;
+    gchar* cookie_string = NULL;
     uint32_t len;
     if (get_cookie_info(decoded_url, &cookie_string, &len) == NPERR_NO_ERROR)
     {
@@ -1262,6 +1260,8 @@
     decoded_url = NULL;
     g_free(cookie_info);
     cookie_info = NULL;
+    g_free(cookie_string);
+    cookie_string = NULL;
   } else if (g_str_has_prefix(parts[1], "PluginSetCookie"))
   {
     // Message structure: plugin PluginSetCookie reference -1 <url> <cookie>



More information about the distro-pkg-dev mailing list