diff --git a/src/osgPlugins/hdr/hdrloader.cpp b/src/osgPlugins/hdr/hdrloader.cpp index e3cbf2246..fe476ce06 100644 --- a/src/osgPlugins/hdr/hdrloader.cpp +++ b/src/osgPlugins/hdr/hdrloader.cpp @@ -121,7 +121,12 @@ bool HDRLoader::load(const char *_fileName, const bool _rawRGBE, HDRLoaderResult if (memcmp(str, "#?RADIANCE", 10)) { - fseek(file, 0, SEEK_SET); + if (fseek(file, 0, SEEK_SET)!=0) + { + fclose(file); + return false; + } + numRead = fread(str, 6, 1, file); if (numRead<1 || memcmp(str, "#?RGBE", 6)) { @@ -129,7 +134,11 @@ bool HDRLoader::load(const char *_fileName, const bool _rawRGBE, HDRLoaderResult return false; } } - fseek(file, 1, SEEK_CUR); + if (fseek(file, 1, SEEK_CUR)!=0) + { + fclose(file); + return false; + } //char cmd[2000]; i = 0;