summaryrefslogtreecommitdiffstats
path: root/perform/zip_perf.c
diff options
context:
space:
mode:
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);
}