Changeset 943

Show
Ignore:
Timestamp:
02/28/00 03:10:54 (9 years ago)
Author:
drach
Message:

Cleaned up errors, memory leaks.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cdat/trunk/cdat/Modules/Cdunifmodule.c

    r845 r943  
    307307                                             /* Check the filetype */ 
    308308        *filetype=CuGetFileType(controlpath); 
     309        if (*filetype==CuUnknown) 
     310                return -1; 
    309311        if (*filetype==CuNetcdf) 
    310312                return ncopen(controlpath,mode); 
     
    499501          Py_DECREF(string); 
    500502        } 
     503        free(s); 
    501504      } 
    502505    } 
     
    661664  } 
    662665  if (self->id == -1) { 
    663     Cdunif_seterror(); 
     666    if (self->filetype == CuUnknown){ 
     667      PyErr_SetObject(CdunifError, Py_BuildValue( "ss","Cannot open file:",filename)); 
     668    } 
     669    else{ 
     670      Cdunif_seterror(); 
     671    } 
    664672    PyCdunifFileObject_dealloc(self); 
    665673    return NULL; 
     
    747755  } 
    748756  collect_attributes(self, NC_GLOBAL, self->attributes, ngattrs); 
     757  return 1; 
    749758} 
    750759 
     
    17911800          if (lastloop >= 0) { 
    17921801            for (i = lastloop; i >= 0; i--) { 
    1793               while (!loop[i] && i >= 0
     1802              while (i>=0 && !loop[i]
    17941803                i--; 
    17951804              if (i >= 0) { 
     
    18171826      if (current != NULL) 
    18181827        free(current); 
     1828      if (loop != NULL) 
     1829        free(loop); 
    18191830    } 
    18201831    free(dims); 
  • cdat/trunk/cdat/Packages/cdms/dataset.py

    r845 r943  
    510510        if cdmsobj._debug==1: 
    511511            print 'Deleting file',self.id 
    512         if self.dictdict != {}: 
     512        # If the object has been deallocated due to open error, 
     513        # it will not have an attribute .dictdict 
     514        if hasattr(self,"dictdict") and self.dictdict != {}: 
    513515            self.close() 
    514516