diff options
Diffstat (limited to 'src/H5FDsec2.c')
-rw-r--r-- | src/H5FDsec2.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 324f489..ab2bc72 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -331,19 +331,18 @@ done: * *------------------------------------------------------------------------- */ -/* ARGSUSED */ static H5FD_t * H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) { - int o_flags; - int fd=(-1); - H5FD_sec2_t *file=NULL; + H5FD_sec2_t *file = NULL; /* sec2 VFD info */ + int fd = (-1); /* File descriptor */ + int o_flags; /* Flags for open() call */ #ifdef _WIN32 HFILE filehandle; struct _BY_HANDLE_FILE_INFORMATION fileinfo; #endif h5_stat_t sb; - H5FD_t *ret_value; + H5FD_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5FD_sec2_open, NULL) @@ -432,9 +431,11 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) ret_value = (H5FD_t*)file; done: - if(ret_value==NULL) { - if(fd>=0) + if(NULL == ret_value) { + if(fd >= 0) HDclose(fd); + if(file) + file = H5FL_FREE(H5FD_sec2_t, file); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -471,7 +472,7 @@ H5FD_sec2_close(H5FD_t *_file) HSYS_GOTO_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file") /* Release the file info */ - (void)H5FL_FREE(H5FD_sec2_t, file); + file = H5FL_FREE(H5FD_sec2_t, file); done: FUNC_LEAVE_NOAPI(ret_value) |