Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
6214c71b
Commit
6214c71b
authored
Jan 04, 2021
by
Ulrich Sibiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Screen.c: check for malloc failures
PVS finding: "V522 There might be dereferencing of a potential null pointer"
parent
a57097ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
Screen.c
nx-X11/programs/Xserver/hw/nxagent/Screen.c
+39
-0
No files found.
nx-X11/programs/Xserver/hw/nxagent/Screen.c
View file @
6214c71b
...
...
@@ -1156,6 +1156,14 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
*/
DepthPtr
depths
=
(
DepthPtr
)
malloc
(
nxagentNumDepths
*
sizeof
(
DepthRec
));
if
(
!
depths
)
{
#ifdef WARNING
fprintf
(
stderr
,
"WARNING: Could not allocate depths array
\n
"
);
#endif
/* FIXME: free data allocated above */
return
False
;
}
for
(
int
i
=
0
;
i
<
nxagentNumDepths
;
i
++
)
{
...
...
@@ -1177,6 +1185,14 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
int
numDepths
=
nxagentNumDepths
;
VisualPtr
visuals
=
(
VisualPtr
)
malloc
(
nxagentNumVisuals
*
sizeof
(
VisualRec
));
if
(
!
visuals
)
{
#ifdef WARNING
fprintf
(
stderr
,
"WARNING: Could not allocate visual array
\n
"
);
#endif
/* FIXME: free data allocated above */
return
False
;
}
int
defaultVisualIndex
=
0
;
...
...
@@ -3058,6 +3074,14 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height,
unsigned
char
*
cBuffer
=
malloc
(
length
);
unsigned
char
*
icBuffer
=
cBuffer
;
if
(
!
cBuffer
)
{
#ifdef WARNING
fprintf
(
stderr
,
"WARNING: could not allocate cBuffer
\n
"
);
#endif
return
;
}
Visual
*
pVisual
=
nxagentImageVisual
((
DrawablePtr
)
nxagentShadowPixmapPtr
,
nxagentShadowDepth
);
if
(
pVisual
==
NULL
)
...
...
@@ -4203,6 +4227,13 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg,
int
nRects
=
RegionNumRects
(
&
cleanRegion
);
int
size
=
nRects
*
sizeof
(
XRectangle
);
XRectangle
*
pRects
=
(
XRectangle
*
)
malloc
(
size
);
if
(
!
pRects
)
{
#ifdef WARNING
fprintf
(
stderr
,
"Could not allocate pRects
\n
"
);
#endif
return
;
}
BoxPtr
pBox
=
RegionRects
(
&
cleanRegion
);
for
(
int
i
=
nRects
;
i
--
>
0
;)
...
...
@@ -4336,6 +4367,14 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg,
int
nRects
=
RegionNumRects
(
clipRegion
);
int
size
=
nRects
*
sizeof
(
XRectangle
);
XRectangle
*
pRects
=
(
XRectangle
*
)
malloc
(
size
);
if
(
!
pRects
)
{
#ifdef WARNING
fprintf
(
stderr
,
"Could not allocate pRects
\n
"
);
#endif
return
;
}
BoxPtr
pBox
=
RegionRects
(
clipRegion
);
for
(
int
i
=
nRects
;
i
--
>
0
;)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment