set first position of a free block to -1, to catch errors

This commit is contained in:
Roberto Ierusalimschy 1994-11-16 16:09:11 -02:00
parent 2b5bc5d1a8
commit a5862498a1
1 changed files with 2 additions and 1 deletions

View File

@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio ** TecCGraf - PUC-Rio
*/ */
char *rcs_mem = "$Id: $"; char *rcs_mem = "$Id: mem.c,v 1.1 1994/11/16 17:38:08 roberto Exp $";
#include <stdlib.h> #include <stdlib.h>
@ -12,6 +12,7 @@ char *rcs_mem = "$Id: $";
void luaI_free (void *block) void luaI_free (void *block)
{ {
*((int *)block) = -1; /* to catch errors */
free(block); free(block);
} }