diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-03 19:41:48 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-12-03 19:41:48 (GMT) |
commit | 77a3cc2292f6021a306372284c20882b8dc8eeeb (patch) | |
tree | 16353ba544c939c32750fef938aee693f3fd05ad /tools/h5dump/h5dumpgentest.c | |
parent | 05bdd6d7293128b774eef1590c016c447e6e14ed (diff) | |
download | hdf5-77a3cc2292f6021a306372284c20882b8dc8eeeb.zip hdf5-77a3cc2292f6021a306372284c20882b8dc8eeeb.tar.gz hdf5-77a3cc2292f6021a306372284c20882b8dc8eeeb.tar.bz2 |
[svn-r17954] Description:
Bring r17953 from trunk to 1.8 branch:
Bring Coverity changes into the trunk:
r17877:
Error 266: Uninitialized memspace set to -1. Changed malloc and free to HDmalloc and HDfree. Removed unused dtype var.
r17878:
Error 265: Uninitialized mem_space set to -1. Changed malloc and free to HDmalloc and HDfree.
Error 267: Uninitialized smspace set to -1. Changed malloc and free to HDmalloc and HDfree.
r17879:
Error 242: Uninitialized aid set to -1.
Error 243: Uninitialized sid set to -1.
Uninitialized tid set to -1 for consistency
r17880:
Error 242: reinitialized aid to -1 after close to be ready for reuse.
Error 243: reinitialized sid to -1 after close to be ready for reuse.
reinitialized tid to -1 for consistency after close to be ready for reuse.
r17881:
use valgrind to check there is a memory leak. The fix is to free ptrstr in line 5838 at xml_dump_group() of h5dump.c after it is used. run the valgrind after the fix, no memory leak for that part of the code.
r17882:
Fix Coverity items 256 and 269.
r17883:
Error 222-230: initialized hid_t vars to -1 after close to be ready for reuse.
Also added H5Tclose for tid in gent_bigdims
r17884:
Bug fix (Coverity run2, view 23, dead code)
(this is pair-program done by Albert, Elena and Larry).
Confirmed and fixed the deadcode in hyperslab read branch of function
diff_datasetid.
(Discovered other bad code that diff_datasetid() should be recoded.
Bug 1693 is entered for this.)
r17906:
Fix Coverity item 260.
r17907:
262: Initialized hid_t's dtype, dtype_tmp and file to -1. Initialized H5T_t * dt to NULL.
r17908:
Fix Coverity item 261.
r17909:
Fix Coverity item 248.
r17910:
Revise fix for Coverity item 248.
r17911:
Resolved coverity issues #s 263, 162, 163, 164. All issues in dsets.c. Initialized fid and did hid_t's. filter_corrupt function was returning in the middle of an if statement, bypassing free calls. Updated error handling to free buffers and hid_t's appropriately.
r17912:
(done by Larry and Albert)
Cleanup Coverity view warnings (#231-241) about
using uninitialized variables. Initialized all
of them.
r17913:
Resolved issue 251 and 264. Initialized tid2 to -1 and initialized buffers that were freed in case of an error.
r17914:
Resolved coverity issues 66, 220, and 221:
66: Negative Return assignment ignored
220,221: Initialized hid_t's.
r17915:
Fix Coverity item 247.
r17916:
Fix Coverity item 246.
r17917:
Fix Coverity item 245.
r17918:
Fix Coverity item 244.
r17919:
Coverity Issue #84: Moved asserts in H5T_cmp to the top of the function, and converted them to HDassert. Coverity complaining about using potentially NULL pointer without checking it. Want to see if Coverity will accept Assertions as acceptable checking before using the value.
Tested on:
FreeBSD/32 6.3 (duty) w/debug
(h5committested on trunk)
Diffstat (limited to 'tools/h5dump/h5dumpgentest.c')
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 93 |
1 files changed, 65 insertions, 28 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index b8ed41d..f4e0b7b 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -5797,12 +5797,12 @@ gent_binary(void) static void gent_bigdims(void) { - hid_t fid; - hid_t did; - hid_t f_sid; - hid_t m_sid; - hid_t tid; - hid_t dcpl; + hid_t fid = -1; + hid_t did = -1; + hid_t f_sid = -1; + hid_t m_sid = -1; + hid_t tid = -1; + hid_t dcpl = -1; hsize_t dims[1]={DIM_4GB}; /* dataset dimensions */ hsize_t chunk_dims[1]={1024}; /* chunk dimensions */ hsize_t hs_start[1]; @@ -5860,14 +5860,21 @@ gent_bigdims(void) buf=NULL; /* close */ + if(H5Tclose(tid) < 0) + goto out; + tid = -1; if(H5Sclose(f_sid) < 0) goto out; + f_sid = -1; if(H5Sclose(m_sid) < 0) goto out; + m_sid = -1; if(H5Pclose(dcpl) < 0) goto out; + dcpl = -1; if(H5Dclose(did) < 0) goto out; + did = -1; ret = H5Fclose(fid); assert(ret >= 0); @@ -5880,11 +5887,11 @@ out: H5Pclose(dcpl); H5Sclose(f_sid); H5Sclose(m_sid); + H5Tclose(tid); H5Dclose(did); H5Fclose(fid); } H5E_END_TRY; return; - } @@ -5931,10 +5938,10 @@ gent_hyperslab(void) static void gent_group_creation_order(void) { - hid_t fid; /* file ID */ - hid_t gid; /* group ID */ - hid_t gcpl_id; /* group creation property list ID */ - hid_t fcpl_id; /* file creation property list ID (to set root group order) */ + hid_t fid = -1; /* file ID */ + hid_t gid = -1; /* group ID */ + hid_t gcpl_id = -1; /* group creation property list ID */ + hid_t fcpl_id = -1; /* file creation property list ID (to set root group order) */ if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) goto out; @@ -5960,37 +5967,45 @@ gent_group_creation_order(void) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "2/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "2/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "2/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "2/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "2/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "2/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "2/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; /*------------------------------------------------------------------------- @@ -6005,45 +6020,56 @@ gent_group_creation_order(void) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "1/c", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "1/b", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "1/a", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "1/a/a2", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "1/a/a1", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "1/a/a2/a22", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if((gid = H5Gcreate2(fid, "1/a/a2/a21", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + gid = -1; if(H5Pclose(gcpl_id) < 0) goto out; + gcpl_id = -1; if(H5Pclose(fcpl_id) < 0) goto out; + fcpl_id = -1; if(H5Fclose(fid) < 0) goto out; + fid = -1; return; @@ -6071,15 +6097,15 @@ out: static void gent_attr_creation_order(void) { - hid_t fid; /* file id */ - hid_t gid; /* group id */ - hid_t did; /* dataset id */ - hid_t sid; /* space id */ - hid_t aid; /* attribute id */ - hid_t tid; /* datatype id */ - hid_t gcpl_id; /* group creation property list ID */ - hid_t dcpl_id; /* dataset creation property list ID */ - hid_t tcpl_id; /* datatype creation property list ID */ + hid_t fid = -1; /* file id */ + hid_t gid = -1; /* group id */ + hid_t did = -1; /* dataset id */ + hid_t sid = -1; /* space id */ + hid_t aid = -1; /* attribute id */ + hid_t tid = -1; /* datatype id */ + hid_t gcpl_id = -1; /* group creation property list ID */ + hid_t dcpl_id = -1; /* dataset creation property list ID */ + hid_t tcpl_id = -1; /* datatype creation property list ID */ int i; const char *attr_name[3] = {"c", "b", "a" }; @@ -6132,10 +6158,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; + aid = -1; } /* end for */ if(H5Dclose(did) < 0) goto out; + did = -1; /*------------------------------------------------------------------------- @@ -6156,10 +6184,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; + aid = -1; } /* end for */ if(H5Dclose(did) < 0) goto out; + did = -1; @@ -6180,11 +6210,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - + aid = -1; } /* end for */ if(H5Gclose(gid) < 0) goto out; + gid = -1; /*------------------------------------------------------------------------- * create a group without creation order tracked for attributes and atributes in it @@ -6203,12 +6234,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - + aid = -1; } /* end for */ if(H5Gclose(gid) < 0) goto out; - + gid = -1; /*------------------------------------------------------------------------- * create a named datatype with creation order tracked for attributes and atributes in it @@ -6230,11 +6261,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - + aid = -1; } /* end for */ if(H5Tclose(tid) < 0) goto out; + tid = -1; /*------------------------------------------------------------------------- * create a named datatype without creation order tracked for attributes and atributes in it @@ -6256,11 +6288,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - + aid = -1; } /* end for */ if(H5Tclose(tid) < 0) goto out; + tid = -1; /*------------------------------------------------------------------------- * add some attributes to the root group @@ -6278,12 +6311,12 @@ gent_attr_creation_order(void) /* close attribute */ if(H5Aclose(aid) < 0) goto out; - + aid = -1; } /* end for */ if(H5Gclose(gid) < 0) goto out; - + gid = -1; /*------------------------------------------------------------------------- * close @@ -6291,15 +6324,19 @@ gent_attr_creation_order(void) */ if(H5Sclose(sid) < 0) goto out; - + sid = -1; if(H5Pclose(dcpl_id) < 0) goto out; + dcpl_id = -1; if(H5Pclose(gcpl_id) < 0) goto out; + gcpl_id = -1; if(H5Pclose(tcpl_id) < 0) goto out; + tcpl_id = -1; if(H5Fclose(fid) < 0) goto out; + fid = -1; |