[Xitami-Dev] Big in sfl library - ini_dyn_loade

Justin Frim xitami-dev@lists.xitami.org
Fri, 26 Mar 2004 14:13:24 -0500 (EST)


Pardon my stupidity, but does this mean Xitami is not affected by this
problem?  (ie Xitami does not use SFL, or it just doesn't use the
ini_dyn_loade function from that library?)


-- 
TTYL,
Justin


> 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
>
>
> --
> Xitami-Dev -- Xitami Development Mailing List
> To unsubscribe: http://lists.xitami.org/mailman/listinfo/xitami-dev
>