From: terencehill Date: Sun, 24 Apr 2022 23:17:18 +0000 (+0200) Subject: Fix "When using the Mine Layer, the game can crash because it tries to free a constan... X-Git-Tag: xonotic-v0.8.5~55 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=44399f8dd5a27a53fa9f6cb89b24f69b3d0433fb;p=xonotic%2Fxonotic-data.pk3dir.git Fix "When using the Mine Layer, the game can crash because it tries to free a constant string.", reported in !1014 --- diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 1dc444b3e..70d57beef 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -1960,14 +1960,13 @@ void unfollow_sameorigin(entity e) .float aiment_deadflag; void SetMovetypeFollow(entity ent, entity e) { - // FIXME this may not be warpzone aware set_movetype(ent, MOVETYPE_FOLLOW); // make the hole follow ent.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid - this means this cannot be teleported by warpzones any more! Instead, we must notice when our owner gets teleported. ent.aiment = e; // make the hole follow bmodel ent.punchangle = e.angles; // the original angles of bmodel ent.view_ofs = ent.origin - e.origin; // relative origin ent.v_angle = ent.angles - e.angles; // relative angles - ent.aiment_classname = strzone(e.classname); + strcpy(ent.aiment_classname, e.classname); ent.aiment_deadflag = e.deadflag; if(IS_PLAYER(ent.aiment)) @@ -1983,8 +1982,7 @@ void UnsetMovetypeFollow(entity ent) { set_movetype(ent, MOVETYPE_FLY); PROJECTILE_MAKETRIGGER(ent); - if (ent.aiment_classname) - strunzone(ent.classname); + strfree(ent.aiment_classname); // FIXME: engine bug? // resetting aiment the engine will set orb's origin close to world's origin //ent.aiment = NULL;