From 75cf0e1d6003d6a21d1d6e0e9273a2482b86c75d Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 18 Jan 2008 15:47:26 +0000 Subject: [PATCH] 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 --- prvm_cmds.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.39.2