summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-07-14 15:15:37 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-07-14 15:17:59 +0300
commitb949ae337a0c1442d5d2b6522bff133c5fd40339 (patch)
tree8afdb2243833758845075c222b4b1d791be57494
parent4ecdc07118503cea4d443b9f4c688aacb8506c43 (diff)
downloadmetacity-b949ae337a0c1442d5d2b6522bff133c5fd40339.tar.gz
compositor: fix memory leak
-rw-r--r--src/compositor/compositor-xrender.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index 4757ff04..b134a2f6 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -861,7 +861,8 @@ root_tile (MetaScreen *screen)
Display *xdisplay = meta_display_get_xdisplay (display);
Picture picture;
Pixmap pixmap;
- gboolean fill = FALSE;
+ gboolean free_pixmap;
+ gboolean fill;
XRenderPictureAttributes pa;
XRenderPictFormat *format;
int p;
@@ -871,6 +872,9 @@ root_tile (MetaScreen *screen)
Window xroot = meta_screen_get_xroot (screen);
pixmap = None;
+ free_pixmap = FALSE;
+ fill = FALSE;
+
background_atoms[0] = DISPLAY_COMPOSITOR (display)->atom_x_root_pixmap;
background_atoms[1] = DISPLAY_COMPOSITOR (display)->atom_x_set_root;
@@ -894,7 +898,6 @@ root_tile (MetaScreen *screen)
{
memcpy (&pixmap, prop, 4);
XFree (prop);
- fill = FALSE;
break;
}
}
@@ -926,6 +929,8 @@ root_tile (MetaScreen *screen)
XSync (xdisplay, False);
XFreeGC (xdisplay, gc);
+
+ free_pixmap = TRUE;
}
}
@@ -934,6 +939,8 @@ root_tile (MetaScreen *screen)
pixmap = XCreatePixmap (xdisplay, xroot, 1, 1,
DefaultDepth (xdisplay, screen_number));
g_return_val_if_fail (pixmap != None, None);
+
+ free_pixmap = TRUE;
fill = TRUE;
}
@@ -954,9 +961,11 @@ root_tile (MetaScreen *screen)
c.alpha = 0xffff;
XRenderFillRectangle (xdisplay, PictOpSrc, picture, &c, 0, 0, 1, 1);
- XFreePixmap (xdisplay, pixmap);
}
+ if (free_pixmap)
+ XFreePixmap (xdisplay, pixmap);
+
return picture;
}