From: MirceaKitsune Date: Mon, 30 Jan 2012 15:15:37 +0000 (+0200) Subject: Free unused strings from memory X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1c041c72ecacc838985b2406568acf2b98939041;p=voretournament%2Fvoretournament.git Free unused strings from memory --- diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc index ea52cda3..c0983860 100644 --- a/data/qcsrc/client/hud.qc +++ b/data/qcsrc/client/hud.qc @@ -1708,10 +1708,26 @@ void Sbar_Portrait() return; if(portrait_time + cvar("sbar_portrait_time") >= time) - if(portrait_image && portrait_name) // prevent using bad strings { - drawpic(left - '120 80 0' - fade_pos, portrait_image, '120 160 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); - drawcolorcodedstring(left - '120 -80 0' - fade_pos, textShortenToWidth(portrait_name, 120, '12 12 0', stringwidth_colors), '12 12 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + if(portrait_image && portrait_name) // prevent using bad strings + { + drawpic(left - '120 80 0' - fade_pos, portrait_image, '120 160 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + drawcolorcodedstring(left - '120 -80 0' - fade_pos, textShortenToWidth(portrait_name, 120, '12 12 0', stringwidth_colors), '12 12 0', sbar_alpha_fg, DRAWFLAG_NORMAL); + } + } + else + { + // free unused strings from memory + if(portrait_image) + { + strunzone(portrait_image); + portrait_image = string_null; + } + if(portrait_name) + { + strunzone(portrait_name); + portrait_name = string_null; + } } }