summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fortran/src/H5Df.c14
-rw-r--r--fortran/src/H5Pf.c3
-rw-r--r--fortran/src/H5Sf.c48
-rw-r--r--fortran/src/H5f90kit.c5
4 files changed, 36 insertions, 34 deletions
diff --git a/fortran/src/H5Df.c b/fortran/src/H5Df.c
index 2c24315..04b38b2 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;
@@ -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 ea53620..49f8daf 100644
--- a/fortran/src/H5Pf.c
+++ b/fortran/src/H5Pf.c
@@ -1632,7 +1632,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;
@@ -1641,6 +1641,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 d44bddd..0a50d25 100644
--- a/fortran/src/H5Sf.c
+++ b/fortran/src/H5Sf.c
@@ -758,10 +758,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;
@@ -771,16 +771,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;
/*
@@ -805,10 +805,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
@@ -834,10 +834,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;
@@ -847,16 +847,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;
/*
@@ -879,10 +879,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;