summaryrefslogtreecommitdiffstats
path: root/perform/zip_perf.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-04-28 22:10:22 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-04-28 22:10:22 (GMT)
commitad35b2bdb2d50d8f73703742c66d5baab6481d18 (patch)
tree1018a9c5a7abc492bcd137eec794de023c4aad27 /perform/zip_perf.c
parent5d97491df4170ec4ad9ea53a0d15f13e66efb712 (diff)
downloadhdf5-ad35b2bdb2d50d8f73703742c66d5baab6481d18.zip
hdf5-ad35b2bdb2d50d8f73703742c66d5baab6481d18.tar.gz
hdf5-ad35b2bdb2d50d8f73703742c66d5baab6481d18.tar.bz2
[svn-r20673] Eliminate memory buffer errors,
overhead - add free to successful path. zip_perf - filename handling needed inits to NULL and free
Diffstat (limited to 'perform/zip_perf.c')
-rw-r--r--perform/zip_perf.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/perform/zip_perf.c b/perform/zip_perf.c
index bf5f2e5..fdd824b 100644
--- a/perform/zip_perf.c
+++ b/perform/zip_perf.c
@@ -66,9 +66,9 @@
#endif
/* internal variables */
-static const char *prog;
-static const char *option_prefix;
-static char *filename;
+static const char *prog=NULL;
+static const char *option_prefix=NULL;
+static char *filename=NULL;
static int compress_percent = 0;
static int compress_level = Z_DEFAULT_COMPRESSION;
static int output, random_test = FALSE;
@@ -175,6 +175,7 @@ cleanup(void)
{
if (!getenv("HDF5_NOCLEANUP"))
unlink(filename);
+ free(filename);
}
static void
@@ -306,17 +307,18 @@ get_unique_name(void)
prefix = option_prefix;
if (prefix)
- /* 2 = 1 for '/' + 1 for null terminator */
- filename = (char *) HDmalloc(strlen(prefix) + strlen(ZIP_PERF_FILE) + 2);
+ /* 2 = 1 for '/' + 1 for null terminator */
+ filename = (char *) HDmalloc(strlen(prefix) + strlen(ZIP_PERF_FILE) + 2);
else
- filename = (char *) HDmalloc(strlen(ZIP_PERF_FILE) + 1);
+ filename = (char *) HDmalloc(strlen(ZIP_PERF_FILE) + 1);
if (!filename)
error("out of memory");
+ filename[0] = 0;
if (prefix){
- strcpy(filename, prefix);
- strcat(filename, "/");
+ strcpy(filename, prefix);
+ strcat(filename, "/");
}
strcat(filename, ZIP_PERF_FILE);
}