{
pg_log_error("could not get size of write-ahead log file \"%s\": %s",
fn, stream->walmethod->getlasterror());
+ pg_free(fn);
return false;
}
if (size == WalSegSz)
{
pg_log_error("could not open existing write-ahead log file \"%s\": %s",
fn, stream->walmethod->getlasterror());
+ pg_free(fn);
return false;
}
}
walfile = f;
+ pg_free(fn);
return true;
}
if (size != 0)
"write-ahead log file \"%s\" has %d bytes, should be 0 or %d",
size),
fn, (int) size, WalSegSz);
+ pg_free(fn);
return false;
}
/* File existed and was empty, so fall through and open */
{
pg_log_error("could not open write-ahead log file \"%s\": %s",
fn, stream->walmethod->getlasterror());
+ pg_free(fn);
return false;
}
+ pg_free(fn);
walfile = f;
return true;
}
filename = dir_get_file_name(pathname, temp_suffix);
snprintf(tmppath, sizeof(tmppath), "%s/%s",
dir_data->basedir, filename);
+ pg_free(filename);
/*
* Open a file for non-compressed as well as compressed files. Tracking
filename = dir_get_file_name(df->pathname, df->temp_suffix);
snprintf(tmppath, sizeof(tmppath), "%s/%s",
dir_data->basedir, filename);
+ pg_free(filename);
/* permanent name, so no need for the prefix */
filename2 = dir_get_file_name(df->pathname, NULL);
snprintf(tmppath2, sizeof(tmppath2), "%s/%s",
dir_data->basedir, filename2);
+ pg_free(filename2);
r = durable_rename(tmppath, tmppath2);
}
else if (method == CLOSE_UNLINK)
filename = dir_get_file_name(df->pathname, df->temp_suffix);
snprintf(tmppath, sizeof(tmppath), "%s/%s",
dir_data->basedir, filename);
+ pg_free(filename);
r = unlink(tmppath);
}
else
if (tarCreateHeader(tar_data->currentfile->header, tmppath, NULL, 0, S_IRUSR | S_IWUSR, 0, 0, time(NULL)) != TAR_OK)
{
pg_free(tar_data->currentfile);
+ pg_free(tmppath);
tar_data->currentfile = NULL;
tar_set_error("could not create tar header");
return NULL;
}
+ pg_free(tmppath);
+
#ifdef HAVE_LIBZ
if (tar_data->compression)
{
ssize_t (*get_file_size) (const char *pathname);
/*
- * Return the name of the current file to work on, without the base
- * directory. This is useful for logging.
+ * Return the name of the current file to work on in pg_malloc()'d string,
+ * without the base directory. This is useful for logging.
*/
char *(*get_file_name) (const char *pathname, const char *temp_suffix);