mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 07:00:03 +01:00
Xext/shm: avoid null dereference in ShmInitScreenPriv()
Reported in #1817: xwayland-24.1.6/redhat-linux-build/../Xext/shm.c:213:23: acquire_memory: this call could return NULL xwayland-24.1.6/redhat-linux-build/../Xext/shm.c:214:9: danger: ‘screen_priv’ could be NULL: unchecked value from [(19)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/18) # 212| if (!screen_priv) { # 213| screen_priv = calloc(1, sizeof(ShmScrPrivateRec)); # 214|-> screen_priv->CloseScreen = pScreen->CloseScreen; # 215| dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv); # 216| pScreen->CloseScreen = ShmCloseScreen; Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2072>
This commit is contained in:
parent
d9389873d6
commit
87e53afd9c
1 changed files with 1 additions and 1 deletions
|
|
@ -210,7 +210,7 @@ ShmInitScreenPriv(ScreenPtr pScreen)
|
|||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||
|
||||
if (!screen_priv) {
|
||||
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
|
||||
screen_priv = XNFcallocarray(1, sizeof(ShmScrPrivateRec));
|
||||
screen_priv->CloseScreen = pScreen->CloseScreen;
|
||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
|
||||
pScreen->CloseScreen = ShmCloseScreen;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue