diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-12-11 16:03:13 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-12-11 16:03:13 +0000 |
| commit | fdcdc8fd46547a7cd77010db6b57f9cc9f4f51d1 (patch) | |
| tree | e7cfd7b774e59fe9b2092ede165e3dd058a20955 /src/Fl_GIF_Image.cxx | |
| parent | 6905f61c2c00bd2e6777b0ab9d843fbe1a46dcc4 (diff) | |
Multiple fixes from Sebastien.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1833 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_GIF_Image.cxx')
| -rw-r--r-- | src/Fl_GIF_Image.cxx | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/Fl_GIF_Image.cxx b/src/Fl_GIF_Image.cxx index 99ba3b6ed..5d6e469de 100644 --- a/src/Fl_GIF_Image.cxx +++ b/src/Fl_GIF_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_GIF_Image.cxx,v 1.1.2.5 2001/11/24 18:07:57 easysw Exp $" +// "$Id: Fl_GIF_Image.cxx,v 1.1.2.6 2001/12/11 16:03:12 easysw Exp $" // // Fl_GIF_Image routines. // @@ -87,9 +87,15 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { } {char b[6]; - if (fread(b,1,6,GifFile)<6) return; /* quit on eof */ + if (fread(b,1,6,GifFile)<6) { + fclose(GifFile); + return; /* quit on eof */ + } if (b[0]!='G' || b[1]!='I' || b[2] != 'F') { - Fl::error("%s is not a GIF file.\n", infname); return;} + Fl::error("%s is not a GIF file.\n", infname); + fclose(GifFile); + return; + } if (b[3]!='8' || b[4]>'9' || b[5]!= 'a') Fl::warning("%s is version %c%c%c.",infname,b[3],b[4],b[5]); } @@ -128,7 +134,11 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { for (;;) { int i = NEXTBYTE; - if (i<0) {Fl::error("%s: unexpected EOF",infname); return;} + if (i<0) { + Fl::error("%s: unexpected EOF",infname); + fclose(GifFile); + return; + } int blocklen; // if (i == 0x3B) return 0; eof code @@ -185,6 +195,7 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { uchar *Image = new uchar[Width*Height]; if (!Image) { Fl::fatal("Insufficient memory for %s.", infname); + fclose(GifFile); return; } @@ -361,9 +372,11 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { alloc_data = 1; delete[] Image; + + fclose(GifFile); } // -// End of "$Id: Fl_GIF_Image.cxx,v 1.1.2.5 2001/11/24 18:07:57 easysw Exp $". +// End of "$Id: Fl_GIF_Image.cxx,v 1.1.2.6 2001/12/11 16:03:12 easysw Exp $". // |
