Fix memory leak in backend/xrender.c

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2018-12-31 08:22:57 +00:00
parent cb12430633
commit 6226ab1228
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 7 additions and 5 deletions

View File

@ -241,17 +241,17 @@ static void render_win(void *backend_data, session_t *ps, win *w, void *win_data
w->pixmap_damaged = false;
region_t reg_paint_local;
pixman_region32_init(&reg_paint_local);
pixman_region32_copy(&reg_paint_local, (region_t *)reg_paint);
pixman_region32_translate(&reg_paint_local, -w->g.x, -w->g.y);
if (!w->invert_color && w->frame_opacity == 1 && !w->dim) {
// No extra processing needed
wd->rendered_pict = wd->pict;
return;
}
region_t reg_paint_local;
pixman_region32_init(&reg_paint_local);
pixman_region32_copy(&reg_paint_local, (region_t *)reg_paint);
pixman_region32_translate(&reg_paint_local, -w->g.x, -w->g.y);
// We don't want to modify the content of the original window when we process
// it, so we create a buffer.
if (wd->buffer == XCB_NONE) {
@ -325,6 +325,8 @@ static void render_win(void *backend_data, session_t *ps, win *w, void *win_data
xcb_render_fill_rectangles(ps->c, XCB_RENDER_PICT_OP_OVER,
wd->rendered_pict, color, 1, &rect);
}
pixman_region32_fini(&reg_paint_local);
}
static void *prepare_win(void *backend_data, session_t *ps, win *w) {