mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-25 00:10:05 +01:00
Xext/sync: avoid null dereference in init_system_idle_counter()
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2835:33: acquire_memory: this call could return NULL
xwayland-24.1.6/redhat-linux-build/../Xext/sync.c:2837:28: danger: ‘priv’ could be NULL: unchecked value from [(30)](sarif:/runs/0/results/4/codeFlows/0/threadFlows/0/locations/29)
# 2835| IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
# 2836|
# 2837|-> priv->value_less = priv->value_greater = NULL;
# 2838| priv->deviceid = deviceid;
# 2839|
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 304d21854d)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2076>
This commit is contained in:
parent
002b68c6f5
commit
39d1c6d770
1 changed files with 4 additions and 2 deletions
|
|
@ -2839,8 +2839,10 @@ init_system_idle_counter(const char *name, int deviceid)
|
|||
if (idle_time_counter != NULL) {
|
||||
IdleCounterPriv *priv = malloc(sizeof(IdleCounterPriv));
|
||||
|
||||
priv->value_less = priv->value_greater = NULL;
|
||||
priv->deviceid = deviceid;
|
||||
if (priv) {
|
||||
priv->value_less = priv->value_greater = NULL;
|
||||
priv->deviceid = deviceid;
|
||||
}
|
||||
|
||||
idle_time_counter->pSysCounterInfo->private = priv;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue