[PATCH xserver 4/5] randr: properly cleanup on crtc and output destroy

Giuseppe Bilotta giuseppe.bilotta at gmail.com
Sat Nov 4 22:06:30 UTC 2017


Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
---
 randr/rrcrtc.c   | 6 ++++++
 randr/rroutput.c | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 2eb9fbdc8..90922484f 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -873,6 +873,11 @@ RRCrtcDestroyResource(void *value, XID pid)
             }
         }
 
+        if (pScrPriv->numCrtcs == 0) {
+            free(pScrPriv->crtcs);
+            pScrPriv->crtcs = NULL;
+        }
+
         RRResourcesChanged(pScreen);
     }
 
@@ -881,6 +886,7 @@ RRCrtcDestroyResource(void *value, XID pid)
     free(crtc->gammaRed);
     if (crtc->mode)
         RRModeDestroy(crtc->mode);
+    free(crtc->outputs);
     free(crtc);
     return 1;
 }
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 647f19a52..12afe7e6c 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -371,6 +371,11 @@ RROutputDestroyResource(void *value, XID pid)
             }
         }
 
+        if (pScrPriv->numOutputs == 0) {
+            free(pScrPriv->outputs);
+            pScrPriv->outputs = NULL;
+        }
+
         RRResourcesChanged(pScreen);
     }
     if (output->modes) {
-- 
2.14.1.439.g647b9b4702



More information about the xorg-devel mailing list