summaryrefslogtreecommitdiffstats
path: root/tools/test/misc
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-01-05 14:58:58 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-01-05 14:58:58 (GMT)
commitc507554935e3c793dd810e3a11cd32b39934fd74 (patch)
treee96bfafc6e146d6cfaf451f18ec9fc9f31658a71 /tools/test/misc
parent5a55331bedbfd6a87ccc4684abfbd172ebb5e55d (diff)
downloadhdf5-c507554935e3c793dd810e3a11cd32b39934fd74.zip
hdf5-c507554935e3c793dd810e3a11cd32b39934fd74.tar.gz
hdf5-c507554935e3c793dd810e3a11cd32b39934fd74.tar.bz2
Clean up valgrind memory leak
Diffstat (limited to 'tools/test/misc')
-rw-r--r--tools/test/misc/clear_open_chk.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/tools/test/misc/clear_open_chk.c b/tools/test/misc/clear_open_chk.c
index f3e6ba3..67b5634 100644
--- a/tools/test/misc/clear_open_chk.c
+++ b/tools/test/misc/clear_open_chk.c
@@ -27,28 +27,28 @@ usage(void)
} /* usage() */
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: To open the file which has zero or nonzero status_flags in
- * the superblock.
+ * Purpose: To open the file which has zero or nonzero status_flags in
+ * the superblock.
*
- * Return: 0 on success
- * 1 on failure
+ * Return: 0 on success
+ * 1 on failure
*
- * Programmer: Vailin Choi; July 2013
+ * Programmer: Vailin Choi; July 2013
*
*-------------------------------------------------------------------------
*/
int
main(int argc, char *argv[])
{
- char *fname; /* The HDF5 file name */
- hid_t fid; /* File ID */
+ char *fname; /* The HDF5 file name */
+ hid_t fid; /* File ID */
/* Check the # of arguments */
if(argc != 2) {
- usage();
- return(EXIT_FAILURE);
+ usage();
+ return(EXIT_FAILURE);
}
/* Get the file name */
@@ -56,14 +56,16 @@ main(int argc, char *argv[])
/* Try opening the file */
if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
- HDfprintf(stderr, "clear_open_chk: unable to open the file\n");
- return EXIT_FAILURE;
+ HDfprintf(stderr, "clear_open_chk: unable to open the file\n");
+ HDfree(fname);
+ return EXIT_FAILURE;
}
+ HDfree(fname);
/* Close the file */
if(H5Fclose(fid) < 0) {
- HDfprintf(stderr, "clear_open_chk: cannot close the file\n");
- return EXIT_FAILURE;
+ HDfprintf(stderr, "clear_open_chk: cannot close the file\n");
+ return EXIT_FAILURE;
}
/* Return success */