frees file names when unstacked

This commit is contained in:
Roberto Ierusalimschy 1994-11-09 16:11:47 -02:00
parent 6b387e01b2
commit 5f2d187b73
1 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@
** Module to control static tables ** Module to control static tables
*/ */
char *rcs_table="$Id: table.c,v 2.12 1994/11/07 16:34:44 roberto Exp roberto $"; char *rcs_table="$Id: table.c,v 2.13 1994/11/08 20:07:54 roberto Exp $";
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -235,7 +235,7 @@ char *lua_createstring (char *s)
*/ */
char *lua_addfile (char *fn) char *lua_addfile (char *fn)
{ {
if (lua_nfile >= MAXFILE-1) if (lua_nfile >= MAXFILE)
return "too many files"; return "too many files";
if ((lua_file[lua_nfile++] = strdup (fn)) == NULL) if ((lua_file[lua_nfile++] = strdup (fn)) == NULL)
return "not enough memory"; return "not enough memory";
@ -247,7 +247,7 @@ char *lua_addfile (char *fn)
*/ */
int lua_delfile (void) int lua_delfile (void)
{ {
free(lua_file[lua_nfile--]); free(lua_file[--lua_nfile]);
return 1; return 1;
} }