changeset 562:b28386115aae

Free two memory leaks
author Adam Domurad <adomurad@redhat.com>
date Wed, 21 Nov 2012 10:54:55 -0500
parents 7205e5aa56e6
children dfc88a1018d9
files ChangeLog plugin/icedteanp/IcedTeaNPPlugin.cc
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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@redhat.com>
+
+	* plugin/icedteanp/IcedTeaNPPlugin.cc
+	(consume_plugin_message): Free two buffers returned from NPN_GetValueForURL function.
+
 2012-11-20  Jiri Vanek <jvanek@redhat.com>
 
 	*  Makefile.am: (stamps/run-netx-dist-tests.stamp)  and
--- 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>