]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
buf_del builtin frees strings in the buffer now
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Jan 2008 15:47:26 +0000 (15:47 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 18 Jan 2008 15:47:26 +0000 (15:47 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7978 d7cf8633-e32d-0410-b094-e92efae38249

prvm_cmds.c

index a1767c159c19e2a463af49acd9890efd1465f2dd..a3505fe8e63ff0637002be738f198e969139eb01 100644 (file)
@@ -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);