diff --git a/utils/flock.c b/utils/flock.c index 5117bc99..56b44258 100644 --- a/utils/flock.c +++ b/utils/flock.c @@ -129,7 +129,7 @@ gzFile flock_zopen(filename, mode, is_locked, fdp) fd = open(fname, oflag); if (fdp != NULL) *fdp = fd; - if (fname != filename) freeMagic(fname); + freeMagic(fname); return gzdopen(fd, mode); } @@ -196,7 +196,7 @@ gzFile flock_zopen(filename, mode, is_locked, fdp) done: if (fdp != NULL) *fdp = fd; - if (fname != filename) freeMagic(fname); + freeMagic(fname); return f; } diff --git a/utils/path.c b/utils/path.c index 3a0fea80..d82dbb55 100644 --- a/utils/path.c +++ b/utils/path.c @@ -70,10 +70,10 @@ bool FileLocking = TRUE; * attempting to open the file. * * Return value: - * The string value that resulted in a valid file descriptor. - * This is a dynamically allocated string *or* a pointer to the - * original filename; the calling routine should check and - * free if needed. + * The string value that resulted in a valid file descriptor + * (a file that could be opened using that filename). + * Return value is a dynamically allocated string the calling + * routine should free. * *------------------------------------------------------------------- */ @@ -91,8 +91,7 @@ PaCheckCompressed(filename) fd = open(gzname, O_RDONLY); if (fd < 0) { - freeMagic(gzname); - gzname = filename; + strcpy(gzname, filename); /* always shorter than allocation */ } else close(fd);