mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
core: fix rare double-free when xinerama update fails
Explicitly set `xinerama_scr_regs` to `NULL` after calling free() to avoid freeing them again. Under normal operation we free the old xinerama screen region list on root screen changes and allocate a new one with the updated regions. On rare occasions — mainly reproducable by changing monitors while DPMS is in standby — updating the region list might fail as for whatever reason the xinerama extension is marked as inactive. This would leave us with an invalid pointer to the already freed region list we would then attempt to free again on the next root screen change.
This commit is contained in:
parent
24b4450726
commit
78e8666498
1 changed files with 1 additions and 0 deletions
|
@ -121,6 +121,7 @@ static inline void free_xinerama_info(session_t *ps) {
|
|||
for (int i = 0; i < ps->xinerama_nscrs; ++i)
|
||||
pixman_region32_fini(&ps->xinerama_scr_regs[i]);
|
||||
free(ps->xinerama_scr_regs);
|
||||
ps->xinerama_scr_regs = NULL;
|
||||
}
|
||||
ps->xinerama_nscrs = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue