summaryrefslogtreecommitdiffstats
path: root/perform/zip_perf.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-04-28 22:10:55 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-04-28 22:10:55 (GMT)
commitbb611704bf8b5e756fb5d7b372a509a5852759b3 (patch)
treed0b2ea0681dd04382d9014140ba7c252a1b3906e /perform/zip_perf.c
parent7f8e7f724ccfa224c1ae0e12f225b09d8cd7839a (diff)
downloadhdf5-bb611704bf8b5e756fb5d7b372a509a5852759b3.zip
hdf5-bb611704bf8b5e756fb5d7b372a509a5852759b3.tar.gz
hdf5-bb611704bf8b5e756fb5d7b372a509a5852759b3.tar.bz2
[svn-r20674] Eliminate memory buffer errors,
overhead - add free to successful path. zip_perf - filename handling needed inits to NULL and free Tested: local linux
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);
}