[Xitami-Dev] Big in sfl library - ini_dyn_loade
Angus Lord
xitami-dev@lists.xitami.org
Fri, 26 Mar 2004 12:08:06 +0100
Hi,
I've found a bug in the sfl library - sflini.c. The function ini_dyn_loade
(with the e) doesn't release the file handle after a file_locate.
The orginal code is
SYMTAB *
ini_dyn_loade (
SYMTAB *load_symtab,
const char *filename)
{
ASSERT (filename);
if (file_locate ("PATH", filename, NULL))
return (ini_dyn_load (load_symtab, filename));
else
return (NULL);
}
Fixed this would be
SYMTAB *
ini_dyn_loade (
SYMTAB *load_symtab,
const char *filename)
{
FILE *fp;
ASSERT (filename);
if ((fp = file_locate ("PATH", filename, NULL)) != NULL) {
file_close(fp);
return (ini_dyn_load (load_symtab, filename));
}
else
return (NULL);
}
I've checked that this method is not used in the smt libaries (xitami) but
could present problems to other developers.
Cheers
Angus Lord