summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5AC.c3
-rw-r--r--src/H5Aint.c31
-rw-r--r--src/H5B.c19
-rw-r--r--src/H5C.c6
-rw-r--r--src/H5Dbtree.c5
-rw-r--r--src/H5Dchunk.c14
-rw-r--r--src/H5Oattr.c15
7 files changed, 55 insertions, 38 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 9273c0c..cbe4dd0 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -3637,7 +3637,8 @@ H5AC_ext_config_2_int_config(H5AC_cache_config_t * ext_conf_ptr,
if ( ( ext_conf_ptr == NULL ) ||
( ext_conf_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) ||
( int_conf_ptr == NULL ) ) {
-
+ HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \
+ "Bad ext_conf_ptr or inf_conf_ptr on entry.")
}
int_conf_ptr->version = H5C__CURR_AUTO_SIZE_CTL_VER;
diff --git a/src/H5Aint.c b/src/H5Aint.c
index d63b5f0..a89c1c9 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -150,32 +150,21 @@ H5A_compact_build_table_cb(H5O_t UNUSED *oh, H5O_mesg_t *mesg/*in,out*/,
/* Re-allocate the table if necessary */
if(udata->curr_attr == udata->atable->nattrs) {
- size_t i;
- size_t n = MAX(1, 2 * udata->atable->nattrs);
- H5A_t **table = (H5A_t **)H5FL_SEQ_CALLOC(H5A_t_ptr, n);
-
- /* Use attribute functions for operation */
- for(i=0; i<udata->atable->nattrs; i++) {
- table[i] = (H5A_t *)H5FL_CALLOC(H5A_t);
- if(NULL == H5A_copy(table[i], udata->atable->attrs[i]))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute")
- if(H5A_close(udata->atable->attrs[i]) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "can't close attribute")
- }
-
- if(udata->atable->nattrs)
- udata->atable->attrs = (H5A_t **)H5FL_SEQ_FREE(H5A_t_ptr, udata->atable->attrs);
+ H5A_t **new_table; /* New table for attributes */
+ size_t new_table_size; /* Number of attributes in new table */
- if(!table)
+ /* Allocate larger table */
+ new_table_size = MAX(1, 2 * udata->atable->nattrs);
+ if(NULL == (new_table = (H5A_t **)H5FL_SEQ_REALLOC(H5A_t_ptr, udata->atable->attrs, new_table_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "unable to extend attribute table")
- udata->atable->attrs = table;
- udata->atable->nattrs = n;
+
+ /* Update table information in user data */
+ udata->atable->attrs = new_table;
+ udata->atable->nattrs = new_table_size;
} /* end if */
/* Copy attribute into table */
- udata->atable->attrs[udata->curr_attr] = (H5A_t *)H5FL_CALLOC(H5A_t);
-
- if(NULL == H5A_copy(udata->atable->attrs[udata->curr_attr], (const H5A_t *)mesg->native))
+ if(NULL == (udata->atable->attrs[udata->curr_attr] = H5A_copy(NULL, (const H5A_t *)mesg->native)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute")
/* Assign [somewhat arbitrary] creation order value, if requested */
diff --git a/src/H5B.c b/src/H5B.c
index 326d675..d915b01 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -1760,7 +1760,7 @@ done:
H5B_shared_t *
H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey)
{
- H5B_shared_t *shared; /* New shared B-tree struct */
+ H5B_shared_t *shared = NULL; /* New shared B-tree struct */
size_t u; /* Local index variable */
H5B_shared_t *ret_value; /* Return value */
@@ -1772,8 +1772,8 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey)
HDassert(type);
/* Allocate space for the shared structure */
- if(NULL == (shared = H5FL_MALLOC(H5B_shared_t)))
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "memory allocation failed for shared B-tree info")
+ if(NULL == (shared = H5FL_CALLOC(H5B_shared_t)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for shared B-tree info")
/* Set up the "global" information for this file's groups */
shared->type = type;
@@ -1788,12 +1788,12 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey)
/* Allocate shared buffers */
if(NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode)))
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree page")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page")
#ifdef H5_CLEAR_MEMORY
HDmemset(shared->page, 0, shared->sizeof_rnode);
#endif /* H5_CLEAR_MEMORY */
if(NULL == (shared->nkey = H5FL_SEQ_MALLOC(size_t, (size_t)(shared->two_k + 1))))
- HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree page")
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys")
/* Initialize the offsets into the native key buffer */
for(u = 0; u < (shared->two_k + 1); u++)
@@ -1803,6 +1803,15 @@ HDmemset(shared->page, 0, shared->sizeof_rnode);
ret_value = shared;
done:
+ if(NULL == ret_value)
+ if(shared) {
+ if(shared->page)
+ shared->page = H5FL_BLK_FREE(page, shared->page);
+ if(shared->nkey)
+ shared->nkey = H5FL_SEQ_FREE(size_t, shared->nkey);
+ shared = H5FL_FREE(H5B_shared_t, shared);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_shared_new() */
diff --git a/src/H5C.c b/src/H5C.c
index 7fc651b..ef58012 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -9814,12 +9814,8 @@ H5C__autoadjust__ageout__insert_new_marker(H5C_t * cache_ptr)
i++;
}
- HDassert( i < H5C__MAX_EPOCH_MARKERS );
-
- if ( (cache_ptr->epoch_marker_active)[i] != FALSE ) {
-
+ if(i >= H5C__MAX_EPOCH_MARKERS)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker.")
- }
HDassert( ((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i );
HDassert( ((cache_ptr->epoch_markers)[i]).next == NULL );
diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c
index 141e1f2..e756f3a 100644
--- a/src/H5Dbtree.c
+++ b/src/H5Dbtree.c
@@ -1485,8 +1485,9 @@ done:
/* Free the raw B-tree node buffer */
if(NULL == storage.u.btree.shared)
HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil")
- if(H5RC_DEC(storage.u.btree.shared) < 0)
- HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
+ else
+ if(H5RC_DEC(storage.u.btree.shared) < 0)
+ HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page")
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index cb7901e..f90e7fa 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -4396,16 +4396,22 @@ H5D_chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
/* create a memory copy of the variable-length datatype */
if(NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0)
+ if((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) {
+ (void)H5T_close(dt_mem);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype")
+ } /* end if */
/* create variable-length datatype at the destinaton file */
if(NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy")
- if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0)
+ if(H5T_set_loc(dt_dst, f_dst, H5T_LOC_DISK) < 0) {
+ (void)H5T_close(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk")
- if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0)
+ } /* end if */
+ if((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) {
+ (void)H5T_close(dt_dst);
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype")
+ } /* end if */
/* Set up the conversion functions */
if(NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem, NULL, NULL, dxpl_id, FALSE)))
@@ -4435,7 +4441,7 @@ H5D_chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src,
/* Atomize */
if((sid_buf = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) {
- H5S_close(buf_space);
+ (void)H5S_close(buf_space);
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID")
} /* end if */
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index 971c514..ad068ad 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -234,6 +234,21 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned UNUSED mesg_fl
ret_value = attr;
done:
+ if(NULL == ret_value) {
+ if(attr) {
+ if(attr->shared) {
+ /* Free any dynamicly allocated items */
+ if(H5A_free(attr) < 0)
+ HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info")
+
+ /* Destroy shared attribute struct */
+ attr->shared = H5FL_FREE(H5A_shared_t, attr->shared);
+ } /* end if */
+ } /* end if */
+
+ attr = H5FL_FREE(H5A_t, attr);
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_attr_decode() */