summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-05-19 04:58:59 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-05-19 04:58:59 (GMT)
commit52d71bcd6f19c7b0adb6544f4c79df94eb1135e4 (patch)
treecc7b05a2d59865db11f02f409ffeadb52cb2afd1 /src
parenteff3014d975a3118360fa38660af910af804cdcd (diff)
downloadhdf5-52d71bcd6f19c7b0adb6544f4c79df94eb1135e4.zip
hdf5-52d71bcd6f19c7b0adb6544f4c79df94eb1135e4.tar.gz
hdf5-52d71bcd6f19c7b0adb6544f4c79df94eb1135e4.tar.bz2
[svn-r13770] Description:
Clean up various memory leaks, etc. Tested on: FreeBSD/32 6.2 (duty)
Diffstat (limited to 'src')
-rw-r--r--src/H5A.c6
-rw-r--r--src/H5CSprivate.h2
-rw-r--r--src/H5FL.c8
-rw-r--r--src/H5FLprivate.h5
-rwxr-xr-xsrc/H5SM.c8
-rw-r--r--src/H5SMcache.c4
-rwxr-xr-xsrc/H5SMpkg.h2
7 files changed, 22 insertions, 13 deletions
diff --git a/src/H5A.c b/src/H5A.c
index 8a74720..9584f0b 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -2095,6 +2095,8 @@ H5A_free(H5A_t *attr)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info")
if(attr->data)
attr->data = H5FL_BLK_FREE(attr_buf, attr->data);
+ if(H5G_name_free(&(attr->path)) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2147,10 +2149,6 @@ H5A_close(H5A_t *attr)
if(H5O_close(&(attr->oloc)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release object header info")
- /* Release the group hier. path for the object the attribute is on */
- if(H5G_name_free(&(attr->path)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path")
-
H5FL_FREE(H5A_t, attr);
done:
diff --git a/src/H5CSprivate.h b/src/H5CSprivate.h
index 15fdc00..13f3b66 100644
--- a/src/H5CSprivate.h
+++ b/src/H5CSprivate.h
@@ -26,7 +26,7 @@
/* Private headers needed by this file */
#include "H5private.h"
-#define H5CS_NSLOTS 32 /*number of slots in an function stack */
+#define H5CS_NSLOTS 48 /*number of slots in an function stack */
/* A function stack */
typedef struct H5CS_t {
diff --git a/src/H5FL.c b/src/H5FL.c
index 2059020..ee62f94 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -99,6 +99,10 @@ typedef struct H5FL_blk_gc_list_t {
static H5FL_blk_gc_list_t H5FL_blk_gc_head={0,NULL};
#ifdef H5FL_TRACK
+
+/* Extra headers needed */
+#include "H5CSprivate.h" /* Function stack */
+
/* Head of "outstanding allocations" list */
static H5FL_track_t *H5FL_out_head_g = NULL;
#endif /* H5FL_TRACK */
@@ -377,7 +381,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
#ifdef H5FL_TRACK
/* Copy allocation location information */
- ((H5FL_track_t *)ret_value)->stack = H5MM_malloc(sizeof(H5CS_t));
+ ((H5FL_track_t *)ret_value)->stack = H5MM_calloc(sizeof(H5CS_t));
H5CS_copy_stack(((H5FL_track_t *)ret_value)->stack);
((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
@@ -875,7 +879,7 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
#ifdef H5FL_TRACK
/* Copy allocation location information */
- ((H5FL_track_t *)ret_value)->stack = H5MM_malloc(sizeof(H5CS_t));
+ ((H5FL_track_t *)ret_value)->stack = H5MM_calloc(sizeof(H5CS_t));
H5CS_copy_stack(((H5FL_track_t *)ret_value)->stack);
((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h
index 5d46bf0..93a853a 100644
--- a/src/H5FLprivate.h
+++ b/src/H5FLprivate.h
@@ -63,9 +63,12 @@
/* Macro for inclusion in the free list allocation parameters */
#define H5FL_TRACK_PARAMS ,const char *call_file, const char *call_func, int call_line
+/* Forward declarations for structure fields */
+struct H5CS_t;
+
/* Tracking information for each block */
typedef struct H5FL_track_t {
- H5CS_t *stack; /* Function stack */
+ struct H5CS_t *stack; /* Function stack */
char *file; /* Name of file containing calling function */
char *func; /* Name of calling function */
int line; /* Line # within calling function */
diff --git a/src/H5SM.c b/src/H5SM.c
index 5d469fd..f5eba52 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -2232,17 +2232,18 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap,
H5O_t *open_oh, hid_t dxpl_id, size_t *encoding_size /*out*/,
void ** encoded_mesg /*out*/)
{
size_t buf_size;
void * encoding_buf=NULL;
- herr_t ret_value = SUCCEED;
H5O_loc_t oloc;
H5O_t *oh = NULL;
- FUNC_ENTER_NOAPI(H5SM_read_mesg, FAIL)
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI_NOINIT(H5SM_read_mesg)
HDassert(f);
HDassert(mesg);
@@ -2282,6 +2283,7 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap,
udata.file = f;
udata.type_id = mesg->msg_type_id;
udata.encoding_buf = NULL;
+ udata.idx = 0;
/* Use the "real" iterate routine so it doesn't try to protect the OH */
op.op_type = H5O_MESG_OP_APP;
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index 07941fb..3b85bcf 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -210,7 +210,7 @@ H5SM_load_table(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
HDassert(f->shared->sohm_vers == HDF5_SHAREDHEADER_VERSION);
/* Allocate space for the master table in memory */
- if(NULL == (table = (H5SM_master_table_t *)H5MM_calloc(sizeof(H5SM_master_table_t))))
+ if(NULL == (table = H5FL_CALLOC(H5SM_master_table_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
/* Read number of indexes and version from file superblock */
@@ -348,7 +348,7 @@ H5SM_dest_table(H5F_t UNUSED *f, H5SM_master_table_t* table)
H5FL_ARR_FREE(H5SM_index_header_t, table->indexes);
- H5MM_free(table);
+ H5FL_FREE(H5SM_master_table_t, table);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5SM_dest_table */
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index 2723bc7..72be9f7 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -207,7 +207,9 @@ typedef struct {
/****************************/
/* Package Variables */
/****************************/
+
/* Declare free lists to manage H5SM structs */
+H5FL_EXTERN(H5SM_master_table_t);
H5FL_ARR_EXTERN(H5SM_index_header_t);
H5FL_EXTERN(H5SM_list_t);
H5FL_ARR_EXTERN(H5SM_sohm_t);