Fix memory leak found
authorJonathan Boeing <jonathan@claws-mail.org>
Sun, 21 Nov 2021 09:44:55 +0000 (02:44 -0700)
committerJonathan Boeing <jonathan@claws-mail.org>
Wed, 29 Dec 2021 10:35:20 +0000 (03:35 -0700)
src/plugins/litehtml_viewer/container_linux.cpp

index 4a455696fbceddceccbfe3ac74148be38d6069ea..5de5086ab0743bb814095c339e37c41c34f27be8 100644 (file)
@@ -134,7 +134,7 @@ void container_linux::draw_background( litehtml::uint_ptr hdc, const litehtml::b
        {
                GdkPixbuf *bgbmp = i->second.first;
 
-               GdkPixbuf *new_img;
+               GdkPixbuf *new_img = NULL;
                if(bg.image_size.width != gdk_pixbuf_get_width(bgbmp) || bg.image_size.height != gdk_pixbuf_get_height(bgbmp))
                {
                        new_img = gdk_pixbuf_scale_simple(bgbmp, bg.image_size.width, bg.image_size.height, GDK_INTERP_BILINEAR);
@@ -176,6 +176,10 @@ void container_linux::draw_background( litehtml::uint_ptr hdc, const litehtml::b
 
                cairo_pattern_destroy(pattern);
                cairo_surface_destroy(img);
+               if(new_img)
+               {
+                       g_object_unref(new_img);
+               }
 
        }