Skip to content

Commit

Permalink
Merge pull request #2947 from 4144/fixskilluse
Browse files Browse the repository at this point in the history
Fix possible use after free in unit_skilluse_id2
  • Loading branch information
MishimaHaruna authored Mar 8, 2021
2 parents ec1a3b7 + 8d3af91 commit fed80d5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/map/unit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,8 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill
if (sd != NULL && sd->auto_cast_current.itemskill_instant_cast && sd->auto_cast_current.type == AUTOCAST_ITEM)
casttime = 0;

map->freeblock_lock();

// in official this is triggered even if no cast time.
clif->useskill(src, src->id, target_id, 0,0, skill_id, skill_lv, casttime);
if( casttime > 0 || temp )
Expand Down Expand Up @@ -1798,6 +1800,8 @@ static int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill
if (sd != NULL && battle_config.prevent_logout_trigger & PLT_SKILL)
sd->canlog_tick = timer->gettick();

map->freeblock_unlock();

return 1;
}

Expand Down

0 comments on commit fed80d5

Please sign in to comment.