[WK2][X11] Don't leak the colormap we created for the plugin
authorkbalazs@webkit.org <kbalazs@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 18:05:28 +0000 (18:05 +0000)
committerkbalazs@webkit.org <kbalazs@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Nov 2011 18:05:28 +0000 (18:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72144

Reviewed by Xan Lopez.

* WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
(WebKit::NetscapePlugin::platformDestroy):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@100464 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp

index 34e5d47..732727d 100644 (file)
@@ -1,3 +1,13 @@
+2011-11-16  Balazs Kelemen  <kbalazs@webkit.org>
+
+        [WK2][X11] Don't leak the colormap we created for the plugin
+        https://bugs.webkit.org/show_bug.cgi?id=72144
+
+        Reviewed by Xan Lopez.
+
+        * WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp:
+        (WebKit::NetscapePlugin::platformDestroy):
+
 2011-11-16  Viatcheslav Ostapenko  <ostapenko.viatcheslav@nokia.com>
 
         [Qt] [WK2] Crash in Connection::readyReadHandler() on socket error
index ae34eac..cde7b06 100644 (file)
@@ -193,10 +193,13 @@ bool NetscapePlugin::platformPostInitialize()
 
 void NetscapePlugin::platformDestroy()
 {
-    delete static_cast<NPSetWindowCallbackStruct*>(m_npWindow.ws_info);
+    NPSetWindowCallbackStruct* callbackStruct = static_cast<NPSetWindowCallbackStruct*>(m_npWindow.ws_info);
+    Display* hostDisplay = x11HostDisplay();
+    XFreeColormap(hostDisplay, callbackStruct->colormap);
+    delete callbackStruct;
 
     if (m_drawable) {
-        XFreePixmap(x11HostDisplay(), m_drawable);
+        XFreePixmap(hostDisplay, m_drawable);
         m_drawable = 0;
     }
 }