forked from github/server
fix Invalid read (valgrind) in remove_skill
This commit is contained in:
parent
832ba5f948
commit
4bccc87f2b
2
clibs
2
clibs
|
@ -1 +1 @@
|
|||
Subproject commit da2c0cc39b27c98ed8d31b0503426788fc236bd8
|
||||
Subproject commit 2a55c27fedec76845cf82c758b7b7c3fa649c286
|
|
@ -1191,7 +1191,7 @@ void remove_skill(unit * u, skill_t sk)
|
|||
for (i = 0; i != u->skill_size; ++i) {
|
||||
sv = u->skills + i;
|
||||
if (sv->id == sk) {
|
||||
memmove(sv, sv + 1, (u->skill_size - 1) * sizeof(skill));
|
||||
memmove(sv, sv + 1, (u->skill_size - i - 1) * sizeof(skill));
|
||||
--u->skill_size;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue