From 44399f8dd5a27a53fa9f6cb89b24f69b3d0433fb Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 25 Apr 2022 01:17:18 +0200 Subject: [PATCH] Fix "When using the Mine Layer, the game can crash because it tries to free a constant string.", reported in !1014 --- qcsrc/common/util.qc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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; -- 2.39.2