Fix several memory leaks

* src/event.c: expose_root: region is not freed
* backend/xrender/xrender.c:
    * bind_pixmap: the reply `r` is not freed
    * blur: reg_op_resized is not freed

Spotted-by: Samuel Hand <samuel.d.hand@gmail.com>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-09-05 16:42:24 +01:00
parent c4369ec756
commit c5145479b0
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
2 changed files with 5 additions and 0 deletions

View File

@ -168,6 +168,7 @@ static bool blur(backend_t *backend_data, double opacity, void *ctx_,
if (!tmp_picture[0] || !tmp_picture[1]) {
log_error("Failed to build intermediate Picture.");
pixman_region32_fini(&reg_op);
pixman_region32_fini(&reg_op_resized);
return false;
}
@ -244,6 +245,7 @@ static bool blur(backend_t *backend_data, double opacity, void *ctx_,
xcb_render_free_picture(c, tmp_picture[0]);
xcb_render_free_picture(c, tmp_picture[1]);
pixman_region32_fini(&reg_op);
pixman_region32_fini(&reg_op_resized);
return true;
}
@ -268,6 +270,8 @@ bind_pixmap(backend_t *base, xcb_pixmap_t pixmap, struct xvisual_info fmt, bool
x_create_picture_with_visual_and_pixmap(base->c, fmt.visual, pixmap, 0, NULL);
img->owned = owned;
img->visual = fmt.visual;
free(r);
if (img->pict == XCB_NONE) {
free(img);
return NULL;

View File

@ -411,6 +411,7 @@ static inline void expose_root(session_t *ps, const rect_t *rects, int nrects) {
region_t region;
pixman_region32_init_rects(&region, rects, nrects);
add_damage(ps, &region);
pixman_region32_fini(&region);
}
static inline void ev_expose(session_t *ps, xcb_expose_event_t *ev) {