summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fortran/src/H5Df.c16
-rw-r--r--fortran/src/H5Pf.c3
-rw-r--r--fortran/src/H5Sf.c48
-rw-r--r--fortran/src/H5f90kit.c5
4 files changed, 37 insertions, 35 deletions
diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c
index 37d36a0..41f8346 100644
--- a/fortran/src/H5Df.c
+++ b/fortran/src/H5Df.c
@@ -283,7 +283,7 @@ nh5dwrite_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_
hid_t c_mem_space_id;
hid_t c_file_space_id;
hid_t c_xfer_prp;
- hobj_ref_t *buf_c;
+ hobj_ref_t *buf_c = NULL;
int i, n;
n = (int)*dims;
@@ -343,7 +343,7 @@ nh5dwrite_ref_obj_c_b (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_spac
hid_t c_mem_space_id;
hid_t c_file_space_id;
hid_t c_xfer_prp;
- hobj_ref_t *buf_c;
+ hobj_ref_t *buf_c = NULL;
int i, n;
n = (int)*dims;
@@ -403,7 +403,7 @@ nh5dwrite_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_
hid_t c_mem_space_id;
hid_t c_file_space_id;
hid_t c_xfer_prp;
- hdset_reg_ref_t *buf_c;
+ hdset_reg_ref_t *buf_c = NULL;
int i, n;
n = (int)*dims;
@@ -464,7 +464,7 @@ nh5dwrite_ref_reg_c_b (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_spac
hid_t c_mem_space_id;
hid_t c_file_space_id;
hid_t c_xfer_prp;
- hdset_reg_ref_t *buf_c;
+ hdset_reg_ref_t *buf_c = NULL;
int i, n;
n = (int)*dims;
@@ -671,7 +671,7 @@ nh5dread_ref_obj_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_i
hid_t c_mem_space_id;
hid_t c_file_space_id;
hid_t c_xfer_prp;
- hobj_ref_t *buf_c;
+ hobj_ref_t *buf_c = NULL;
int i, n;
n = (int)*dims;
/*
@@ -730,7 +730,7 @@ nh5dread_ref_obj_c_b (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space
hid_t c_mem_space_id;
hid_t c_file_space_id;
hid_t c_xfer_prp;
- hobj_ref_t *buf_c;
+ hobj_ref_t *buf_c = NULL;
hsize_t i,n;
n = (hsize_t)*dims;
/*
@@ -789,7 +789,7 @@ nh5dread_ref_reg_c (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space_i
hid_t c_mem_space_id;
hid_t c_file_space_id;
hid_t c_xfer_prp;
- hdset_reg_ref_t *buf_c;
+ hdset_reg_ref_t *buf_c = NULL;
int i, n;
n = (int)*dims;
/*
@@ -848,7 +848,7 @@ nh5dread_ref_reg_c_b (hid_t_f *dset_id, hid_t_f *mem_type_id, hid_t_f *mem_space
hid_t c_mem_space_id;
hid_t c_file_space_id;
hid_t c_xfer_prp;
- hdset_reg_ref_t *buf_c;
+ hdset_reg_ref_t *buf_c = NULL;
hsize_t i, n;
n = (hsize_t)*dims;
/*
diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c
index fc3f124..50305fd 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -1636,7 +1636,7 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name,
int c_idx;
herr_t status;
size_t c_namelen;
- char* c_name;
+ char* c_name = NULL;
off_t c_offset;
hsize_t size;
@@ -1645,6 +1645,7 @@ nh5pget_external_c(hid_t_f *prp_id, int_f *idx, size_t_f* name_size, _fcd name,
* Allocate memory to store the name of the external file.
*/
if(c_namelen) c_name = (char*) HDmalloc(c_namelen + 1);
+ if (c_name == NULL) return ret_value;
/*
* Call H5Pget_external function.
diff --git a/fortran/src/H5Sf.c b/fortran/src/H5Sf.c
index 24ca3e6..ae3a201 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -757,10 +757,10 @@ nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize
{
int ret_value = -1;
hid_t c_space_id;
- hssize_t *c_start;
- hsize_t *c_count;
- hsize_t *c_stride;
- hsize_t *c_block;
+ hssize_t *c_start = NULL;
+ hsize_t *c_count = NULL;
+ hsize_t *c_stride = NULL;
+ hsize_t *c_block = NULL;
H5S_seloper_t c_op;
herr_t status;
@@ -770,16 +770,16 @@ nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize
rank = H5Sget_simple_extent_ndims(*space_id);
if (rank < 0 ) return ret_value;
c_start = (hssize_t *)HDmalloc(sizeof(hssize_t)*rank);
- if (!c_start) goto DONE;
+ if (c_start == NULL) goto DONE;
c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
- if (!c_count) goto DONE;
+ if (c_count == NULL) goto DONE;
c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
- if (!c_stride) goto DONE;
+ if (c_stride == NULL) goto DONE;
c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
- if (!c_block) goto DONE;
+ if (c_block == NULL) goto DONE;
/*
@@ -804,10 +804,10 @@ nh5sselect_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsize
status = H5Sselect_hyperslab(c_space_id, c_op, c_start, c_stride, c_count, c_block);
if ( status >= 0 ) ret_value = 0;
DONE:
- if(!c_start ) HDfree(c_start);
- if(!c_count ) HDfree(c_count);
- if(!c_stride) HDfree(c_stride);
- if(!c_block ) HDfree(c_block);
+ if(c_start != NULL) HDfree(c_start);
+ if(c_count != NULL) HDfree(c_count);
+ if(c_stride!= NULL) HDfree(c_stride);
+ if(c_block != NULL) HDfree(c_block);
return ret_value;
}
#ifdef NEW_HYPERSLAB_API
@@ -833,10 +833,10 @@ nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsiz
int ret_value = -1;
hid_t c_space_id;
hid_t c_hyper_id;
- hssize_t *c_start;
- hsize_t *c_count;
- hsize_t *c_stride;
- hsize_t *c_block;
+ hssize_t *c_start = NULL;
+ hsize_t *c_count = NULL;
+ hsize_t *c_stride = NULL;
+ hsize_t *c_block = NULL;
H5S_seloper_t c_op;
herr_t status;
@@ -846,16 +846,16 @@ nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsiz
rank = H5Sget_simple_extent_ndims(*space_id);
if (rank < 0 ) return ret_value;
c_start = (hssize_t *)HDmalloc(sizeof(hssize_t)*rank);
- if (!c_start) goto DONE;
+ if (c_start == NULL) goto DONE;
c_count = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
- if (!c_count) goto DONE;
+ if (c_count == NULL) goto DONE;
c_stride = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
- if (!c_stride) goto DONE;
+ if (c_stride == NULL) goto DONE;
c_block = (hsize_t *)HDmalloc(sizeof(hsize_t)*rank);
- if (!c_block) goto DONE;
+ if (c_block == NULL) goto DONE;
/*
@@ -878,10 +878,10 @@ nh5scombine_hyperslab_c ( hid_t_f *space_id , int_f *op, hssize_t_f *start, hsiz
*hyper_id = (hid_t_f)c_hyper_id;
ret_value = 0;
DONE:
- if(!c_start ) HDfree(c_start);
- if(!c_count ) HDfree(c_count);
- if(!c_stride) HDfree(c_stride);
- if(!c_block ) HDfree(c_block);
+ if(c_start != NULL) HDfree(c_start);
+ if(c_count != NULL) HDfree(c_count);
+ if(c_stride!= NULL) HDfree(c_stride);
+ if(c_block != NULL) HDfree(c_block);
return ret_value;
}
/*----------------------------------------------------------------------------
diff --git a/fortran/src/H5f90kit.c b/fortran/src/H5f90kit.c
index 86cb8fc..0f8fed4 100644
--- a/fortran/src/H5f90kit.c
+++ b/fortran/src/H5f90kit.c
@@ -70,7 +70,8 @@ DESCRIPTION
char *
HD5f2cstring(_fcd fdesc, int len)
{
- char *cstr, *str;
+ char *cstr = NULL;
+ char *str;
int i;
str = _fcdtocp(fdesc);
@@ -78,7 +79,7 @@ HD5f2cstring(_fcd fdesc, int len)
for(i=len-1; i>=0 && !isgraph((int)str[i]); i--)
/*EMPTY*/;
cstr = (char *) HDmalloc( (i + 2));
- if (!cstr) return NULL;
+ if (cstr == NULL) return NULL;
cstr[i + 1] = '\0';
HDmemcpy(cstr,str,i+1);
return cstr;