summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-02-15 11:58:52 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-02-15 11:58:52 +1000
commit88517ced1fa2e621be2d05a319b522b3111da516 (patch)
tree570fecb360df833ae7c1e5eb31dc3a33ed1ebf49 /Xext
parent82425c66e7a8c436b5be7ad44880dd4be6c1f06a (diff)
parent73974dd7ea9ca4d4cdd5464cb813088a6ee9770b (diff)
Merge branch 'master' of git+ssh://people.freedesktop.org/~alanc/xserver into next
Diffstat (limited to 'Xext')
-rw-r--r--Xext/sync.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/Xext/sync.c b/Xext/sync.c
index 4d11992bb..9ae5b3981 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2747,7 +2747,6 @@ init_system_idle_counter(const char *name, int deviceid)
{
CARD64 resolution;
XSyncValue idle;
- IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
SyncCounter *idle_time_counter;
IdleTimeQueryValue(NULL, &idle);
@@ -2758,10 +2757,14 @@ init_system_idle_counter(const char *name, int deviceid)
IdleTimeQueryValue,
IdleTimeBracketValues);
- priv->deviceid = deviceid;
- priv->value_less = priv->value_greater = NULL;
+ if (idle_time_counter != NULL) {
+ IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
- idle_time_counter->pSysCounterInfo->private = priv;
+ priv->value_less = priv->value_greater = NULL;
+ priv->deviceid = deviceid;
+
+ idle_time_counter->pSysCounterInfo->private = priv;
+ }
return idle_time_counter;
}
@@ -2786,6 +2789,6 @@ void SyncRemoveDeviceIdleTime(SyncCounter *counter)
/* FreeAllResources() frees all system counters before the devices are
shut down, check if there are any left before freeing the device's
counter */
- if (!xorg_list_is_empty(&SysCounterList))
+ if (counter && !xorg_list_is_empty(&SysCounterList))
xorg_list_del(&counter->pSysCounterInfo->entry);
}