[xserver] xfree86: fix Xorg memory leak when run xrandr
Xiaogang Chen
chenxiaogang888 at gmail.com
Mon Feb 20 18:55:49 UTC 2017
xf86DDCGetModes generates some DisplayMods that are not used and not released after.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99521
Signed-off-by: Xiaogang Chen <Xiaogang.Chen at amd.com>
---
hw/xfree86/modes/xf86EdidModes.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index f0e1e97..915b291 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -1201,18 +1201,11 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
/* look for last Mode */
Mode = Modes;
- while (Mode->next)
- Mode = Mode->next;
+ /*release these video modes that are not used after*/
+ while (Mode) {
+ xf86DeleteMode(&Modes, Mode);
+ Mode = Modes;
+ }
- /* add to MonPtr */
- if (Monitor->Modes) {
- Monitor->Last->next = Modes;
- Modes->prev = Monitor->Last;
- Monitor->Last = Mode;
- }
- else {
- Monitor->Modes = Modes;
- Monitor->Last = Mode;
- }
}
}
--
2.7.4
More information about the xorg-devel
mailing list