Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
8136f552
Commit
8136f552
authored
3 years ago
by
Hannu Hanhi
Browse files
Options
Downloads
Patches
Plain Diff
Fix uninitialized history pointers in thinkframe_hooks array
parent
77ecfb9c
No related branches found
No related tags found
1 merge request
!1643
Perfstats averaging and refactor
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/m_perfstats.c
+7
-3
7 additions, 3 deletions
src/m_perfstats.c
with
7 additions
and
3 deletions
src/m_perfstats.c
+
7
−
3
View file @
8136f552
...
...
@@ -194,14 +194,18 @@ void PS_SetThinkFrameHookInfo(int index, precise_t time_taken, char* short_src)
if
(
!
thinkframe_hooks
)
{
// array needs to be initialized
thinkframe_hooks
=
Z_
M
alloc
(
sizeof
(
ps_hookinfo_t
)
*
thinkframe_hooks_capacity
,
PU_STATIC
,
NULL
);
thinkframe_hooks
=
Z_
C
alloc
(
sizeof
(
ps_hookinfo_t
)
*
thinkframe_hooks_capacity
,
PU_STATIC
,
NULL
);
}
if
(
index
>=
thinkframe_hooks_capacity
)
{
// array needs more space, realloc with double size
thinkframe_hooks_capacity
*
=
2
;
int
new_capacity
=
thinkframe_hooks_capacity
*
2
;
thinkframe_hooks
=
Z_Realloc
(
thinkframe_hooks
,
sizeof
(
ps_hookinfo_t
)
*
thinkframe_hooks_capacity
,
PU_STATIC
,
NULL
);
sizeof
(
ps_hookinfo_t
)
*
new_capacity
,
PU_STATIC
,
NULL
);
// initialize new memory with zeros so the pointers in the structs are null
memset
(
&
thinkframe_hooks
[
thinkframe_hooks_capacity
],
0
,
sizeof
(
ps_hookinfo_t
)
*
thinkframe_hooks_capacity
);
thinkframe_hooks_capacity
=
new_capacity
;
}
thinkframe_hooks
[
index
].
time_taken
.
value
.
p
=
time_taken
;
memcpy
(
thinkframe_hooks
[
index
].
short_src
,
short_src
,
LUA_IDSIZE
*
sizeof
(
char
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment