1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2024-11-11 13:51:02 -05:00

backend: fix leak in default_backend_render_shadow

This commit is contained in:
Maxim Solovyov 2023-02-13 02:23:53 +03:00
parent cee1287562
commit ce7758a07b
No known key found for this signature in database

View file

@ -294,13 +294,14 @@ shadow_picture_err:
void *default_backend_render_shadow(backend_t *backend_data, int width, int height, void *default_backend_render_shadow(backend_t *backend_data, int width, int height,
struct backend_shadow_context *sctx, struct color color) { struct backend_shadow_context *sctx, struct color color) {
const conv *kernel = (void *)sctx; const conv *kernel = (void *)sctx;
xcb_pixmap_t shadow_pixel = solid_picture(backend_data->c, backend_data->root, true, xcb_render_picture_t shadow_pixel = solid_picture(
1, color.red, color.green, color.blue), backend_data->c, backend_data->root, true, 1, color.red, color.green, color.blue);
shadow = XCB_NONE; xcb_pixmap_t shadow = XCB_NONE;
xcb_render_picture_t pict = XCB_NONE; xcb_render_picture_t pict = XCB_NONE;
if (!build_shadow(backend_data->c, backend_data->root, color.alpha, width, height, if (!build_shadow(backend_data->c, backend_data->root, color.alpha, width, height,
kernel, shadow_pixel, &shadow, &pict)) { kernel, shadow_pixel, &shadow, &pict)) {
xcb_render_free_picture(backend_data->c, shadow_pixel);
return NULL; return NULL;
} }
@ -308,6 +309,7 @@ void *default_backend_render_shadow(backend_t *backend_data, int width, int heig
void *ret = backend_data->ops->bind_pixmap( void *ret = backend_data->ops->bind_pixmap(
backend_data, shadow, x_get_visual_info(backend_data->c, visual), true); backend_data, shadow, x_get_visual_info(backend_data->c, visual), true);
xcb_render_free_picture(backend_data->c, pict); xcb_render_free_picture(backend_data->c, pict);
xcb_render_free_picture(backend_data->c, shadow_pixel);
return ret; return ret;
} }