mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-26 04:10:12 +01:00
Xext/vidmode: avoid null dereference if VidModeCreateMode() allocation fails
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../Xext/vidmode.c:96:5: warning[-Wanalyzer-null-argument]: use of NULL ‘VidModeCreateMode()’ where non-null expected
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(cherry picked from commit 5e62aaaf57)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2076>
This commit is contained in:
parent
ad999d0c9d
commit
ed27eefea9
1 changed files with 4 additions and 0 deletions
|
|
@ -808,6 +808,8 @@ ProcVidModeModModeLine(ClientPtr client)
|
|||
return BadValue;
|
||||
|
||||
modetmp = VidModeCreateMode();
|
||||
if (modetmp == NULL)
|
||||
return BadAlloc;
|
||||
VidModeCopyMode(mode, modetmp);
|
||||
|
||||
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
|
||||
|
|
@ -951,6 +953,8 @@ ProcVidModeValidateModeLine(ClientPtr client)
|
|||
return BadValue;
|
||||
|
||||
modetmp = VidModeCreateMode();
|
||||
if (modetmp == NULL)
|
||||
return BadAlloc;
|
||||
VidModeCopyMode(mode, modetmp);
|
||||
|
||||
VidModeSetModeValue(modetmp, VIDMODE_H_DISPLAY, stuff->hdisplay);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue