Here's a bug that causes a filehandle leak in GEM. Every time an image load is attempted via image2mem() (used by [pix_image], [pix_multiimage], etc.) then a series of decoders are called one after the other, quitting after the first that succeeds. If the file exists and is not of any type handled before the SGI handler and not of SGI type either, the SGI decoder does not close the file handle.
This happened several times when loading a *lot* of TIFF images on Windows during a Pd/GEM workshop at Videographe, this afternoon. When too many files are "open", then PureData can't open any new patch and can't even save any modified patches!
Did I get it right?
Index: src/Base/sgiimage.cpp =================================================================== RCS file: /cvsroot/pd-gem/Gem/src/Base/sgiimage.cpp,v retrieving revision 1.5 diff -u -r1.5 sgiimage.cpp --- src/Base/sgiimage.cpp 14 Sep 2003 16:03:59 -0000 1.5 +++ src/Base/sgiimage.cpp 13 Jun 2005 20:57:05 -0000 @@ -248,6 +248,7 @@ if(image.imagic != IMAGIC) { /* fprintf(stderr,"sizeofimage: bad magic number in image file\n"); */ + fclose(inf); return(0); } *xsize = image.xsize;
,-o--------o--------o--------o-. ,---. irc.freenode.net #dataflow | | The Diagram is the Program tm| | ,-o-------------o--------------o-. `-o------------o-------------o-' | | Mathieu Bouchard (Montréal QC) | | téléphone:+1.514.383.3801`---' `-o-- http://artengine.ca/matju -'
Mathieu Bouchard wrote:
Did I get it right?
wow.
weird that this one got unnoticed for so long. (but probably i have changed the order of codecs, so that this bug now gets triggered more often, so it exposed itself to the public interest)
thanks for the fix, i've committed it (and several other occurences of the same bug in sgiimage.cpp)
mfg.ads.r IOhannes