[mutter] monitor-manager-kms: Avoid a couple of potential crashes
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor-manager-kms: Avoid a couple of potential crashes
- Date: Tue, 28 Apr 2015 16:01:26 +0000 (UTC)
commit 7eca43cec93b37a3db3a2d66aff86569e0f60313
Author: Rui Matos <tiagomatos gmail com>
Date: Tue Apr 28 16:52:20 2015 +0200
monitor-manager-kms: Avoid a couple of potential crashes
The drm API can return NULL and we could end up using uninitialized
memory if the driver private struct isn't cleared.
src/backends/native/meta-monitor-manager-kms.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c
index 3e1cef3..f0d9380 100644
--- a/src/backends/native/meta-monitor-manager-kms.c
+++ b/src/backends/native/meta-monitor-manager-kms.c
@@ -224,6 +224,9 @@ find_crtc_properties (MetaMonitorManagerKms *manager_kms,
crtc_kms = meta_crtc->driver_private;
props = drmModeObjectGetProperties (manager_kms->fd, meta_crtc->crtc_id, DRM_MODE_OBJECT_CRTC);
+ if (!props)
+ return;
+
for (i = 0; i < props->count_props; i++)
{
drmModePropertyPtr prop = drmModeGetProperty (manager_kms->fd, props->props[i]);
@@ -479,7 +482,7 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
height = MAX (height, meta_crtc->rect.y + meta_crtc->rect.height);
}
- meta_crtc->driver_private = g_new (MetaCRTCKms, 1);
+ meta_crtc->driver_private = g_new0 (MetaCRTCKms, 1);
meta_crtc->driver_notify = (GDestroyNotify) meta_crtc_destroy_notify;
find_crtc_properties (manager_kms, meta_crtc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]