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
828d7e71
Commit
828d7e71
authored
4 years ago
by
James R.
Browse files
Options
Downloads
Patches
Plain Diff
Fix uninitialized last element when using Taggroup_Remove
parent
314fd278
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1292
Lua multitagging
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/taglist.c
+4
-5
4 additions, 5 deletions
src/taglist.c
with
4 additions
and
5 deletions
src/taglist.c
+
4
−
5
View file @
828d7e71
...
...
@@ -188,7 +188,7 @@ void Taggroup_Remove (taggroup_t *garray[], const mtag_t tag, size_t id)
{
taggroup_t
*
group
;
size_t
rempos
;
size_t
new
count
;
size_t
old
count
;
if
(
tag
==
MTAG_GLOBAL
)
return
;
...
...
@@ -204,7 +204,7 @@ void Taggroup_Remove (taggroup_t *garray[], const mtag_t tag, size_t id)
unset_bit_array
(
tags_available
,
tag
);
// Strip away taggroup if no elements left.
if
(
!
(
new
count
=
--
group
->
count
))
if
(
!
(
old
count
=
group
->
count
--
))
{
Z_Free
(
group
->
elements
);
Z_Free
(
group
);
...
...
@@ -212,19 +212,18 @@ void Taggroup_Remove (taggroup_t *garray[], const mtag_t tag, size_t id)
}
else
{
size_t
*
newelements
=
Z_Malloc
(
new
count
*
sizeof
(
size_t
),
PU_LEVEL
,
NULL
);
size_t
*
newelements
=
Z_Malloc
(
group
->
count
*
sizeof
(
size_t
),
PU_LEVEL
,
NULL
);
size_t
i
;
// Copy the previous entries save for the one to remove.
for
(
i
=
0
;
i
<
rempos
;
i
++
)
newelements
[
i
]
=
group
->
elements
[
i
];
for
(
i
=
rempos
+
1
;
i
<
group
->
count
;
i
++
)
for
(
i
=
rempos
+
1
;
i
<
old
count
;
i
++
)
newelements
[
i
-
1
]
=
group
->
elements
[
i
];
Z_Free
(
group
->
elements
);
group
->
elements
=
newelements
;
group
->
count
=
newcount
;
}
}
...
...
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