diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/im_file.cpp | 3 | ||||
| -rw-r--r-- | src/im_format.cpp | 23 | 
2 files changed, 20 insertions, 6 deletions
diff --git a/src/im_file.cpp b/src/im_file.cpp index 3bfa779..9a4519a 100644 --- a/src/im_file.cpp +++ b/src/im_file.cpp @@ -2,7 +2,7 @@   * \brief File Access   *   * See Copyright Notice in im_lib.h - * $Id: im_file.cpp,v 1.5 2009/08/23 23:57:51 scuri Exp $ + * $Id: im_file.cpp,v 1.6 2009/11/23 17:13:05 scuri Exp $   */  #include <stdlib.h> @@ -125,6 +125,7 @@ void imFileClose(imFile* ifile)    if (ifile->line_buffer) free(ifile->line_buffer);    delete attrib_table; +  delete ifileformat;  }  void* imFileHandle(imFile* ifile, int index) diff --git a/src/im_format.cpp b/src/im_format.cpp index d389743..ad04a3b 100644 --- a/src/im_format.cpp +++ b/src/im_format.cpp @@ -2,7 +2,7 @@   * \brief File Format Access   *   * See Copyright Notice in im_lib.h - * $Id: im_format.cpp,v 1.2 2008/12/03 15:45:34 scuri Exp $ + * $Id: im_format.cpp,v 1.3 2009/11/23 17:13:05 scuri Exp $   */ @@ -194,7 +194,7 @@ imFileFormatBase* imFileFormatBaseOpen(const char* file_name, int *error)          imFileFormatBase* ifileformat = iformat->Create();          *error = ifileformat->Open(file_name);                                                         if (*error != IM_ERR_NONE && *error != IM_ERR_FORMAT)  // Error situation that must abort -        {                                                      // Only IM_ERR_FORMAT is a valid error here +        {                                                      // Only IM_ERR_FORMAT is considered here            free(extension);            delete [] ext_mark;            delete ifileformat; @@ -206,6 +206,11 @@ imFileFormatBase* imFileFormatBaseOpen(const char* file_name, int *error)            delete [] ext_mark;            return ifileformat;          } +        else +        { +          /* Other errors, release the format and test another one */ +          delete ifileformat; +        }        }      } @@ -233,6 +238,11 @@ imFileFormatBase* imFileFormatBaseOpen(const char* file_name, int *error)          delete [] ext_mark;          return ifileformat;        } +      else +      { +        /* Other errors, release the format and test another one */ +        delete ifileformat; +      }      }    } @@ -269,9 +279,12 @@ imFileFormatBase* imFileFormatBaseOpenAs(const char* file_name, const char* form    }    else if (*error == IM_ERR_NONE) // Sucessfully oppened the file      return ifileformat; - -  *error = IM_ERR_FORMAT; -  return NULL; +  else +  { +    *error = IM_ERR_FORMAT; +    delete ifileformat; +    return NULL; +  }  }  imFileFormatBase* imFileFormatBaseNew(const char* file_name, const char* format, int *error)  | 
