From: havoc Date: Fri, 18 Jan 2008 15:47:26 +0000 (+0000) Subject: buf_del builtin frees strings in the buffer now X-Git-Tag: xonotic-v0.1.0preview~2530 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=75cf0e1d6003d6a21d1d6e0e9273a2482b86c75d;p=xonotic%2Fdarkplaces.git buf_del builtin frees strings in the buffer now git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7978 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/prvm_cmds.c b/prvm_cmds.c index a1767c15..a3505fe8 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -3688,7 +3688,15 @@ void VM_buf_del (void) VM_SAFEPARMCOUNT(1, VM_buf_del); stringbuffer = (prvm_stringbuffer_t *)Mem_ExpandableArray_RecordAtIndex(&prog->stringbuffersarray, (int)PRVM_G_FLOAT(OFS_PARM0)); if (stringbuffer) + { + int i; + for (i = 0;i < stringbuffer->num_strings;i++) + if (stringbuffer->strings[i]) + Mem_Free(stringbuffer->strings[i]); + if (stringbuffer->strings) + Mem_Free(stringbuffer->strings); Mem_ExpandableArray_FreeRecord(&prog->stringbuffersarray, stringbuffer); + } else { VM_Warning("VM_buf_del: invalid buffer %i used in %s\n", (int)PRVM_G_FLOAT(OFS_PARM0), PRVM_NAME);