Move deallocation of damage_ring to deinit_render

Fix a memory leak when compton is reset.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-02 19:54:02 +00:00
parent 6eff9ebf8b
commit 7d10db6531
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
2 changed files with 7 additions and 4 deletions

View File

@ -3150,10 +3150,6 @@ session_destroy(session_t *ps) {
free_paint(ps, &ps->tgt_buffer);
pixman_region32_fini(&ps->screen_reg);
for (int i = 0; i < ps->ndamage; ++i)
pixman_region32_fini(&ps->damage_ring[i]);
ps->ndamage = 0;
ps->damage_ring = ps->damage = NULL;
free(ps->expose_rects);
free(ps->o.config_file);

View File

@ -1205,6 +1205,13 @@ void deinit_render(session_t *ps) {
// Free other X resources
free_root_tile(ps);
// Free the damage ring
for (int i = 0; i < ps->ndamage; ++i)
pixman_region32_fini(&ps->damage_ring[i]);
ps->ndamage = 0;
free(ps->damage_ring);
ps->damage_ring = ps->damage = NULL;
#ifdef CONFIG_OPENGL
glx_destroy(ps);
#endif