Skip to content

Commit 6d4c966

Browse files
committed
Instead of palloc's use static strings
1 parent 40118ca commit 6d4c966

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/backup.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,11 +1964,12 @@ parse_backup_filelist_filenames(parray *files, const char *root)
19641964
{
19651965
pgFile *file = (pgFile *) parray_get(files, i);
19661966
char *relative;
1967-
char *filename = palloc(MAXPGPATH);
1967+
char filename[MAXPGPATH];
19681968
int sscanf_result;
19691969

19701970
relative = GetRelativePath(file->path, root);
19711971
file->is_cfs = false;
1972+
filename[0] = '\0';
19721973

19731974
elog(VERBOSE, "-----------------------------------------------------: %s", relative);
19741975
if (path_is_prefix_of_path("global", relative))
@@ -2010,7 +2011,7 @@ parse_backup_filelist_filenames(parray *files, const char *root)
20102011
}
20112012
else if (path_is_prefix_of_path(PG_TBLSPC_DIR, relative))
20122013
{
2013-
char *temp_relative_path = palloc(MAXPGPATH);
2014+
char temp_relative_path[MAXPGPATH];
20142015

20152016
sscanf_result = sscanf(relative, "pg_tblspc/%u/%s", &(file->tblspcOid), temp_relative_path);
20162017
elog(VERBOSE, "pg_tblspc sscanf result: %i", sscanf_result);
@@ -2084,7 +2085,7 @@ parse_backup_filelist_filenames(parray *files, const char *root)
20842085
}
20852086

20862087
/* Check files located inside database directories */
2087-
if (filename && file->dbOid != 0)
2088+
if (filename[0] != '\0' && file->dbOid != 0)
20882089
{
20892090
if (strcmp(filename, "pg_internal.init") == 0)
20902091
{
@@ -2111,7 +2112,7 @@ parse_backup_filelist_filenames(parray *files, const char *root)
21112112
* Check that and do not mark them with 'is_datafile' flag.
21122113
*/
21132114
char *forkNameptr;
2114-
char *suffix = palloc(MAXPGPATH);
2115+
char suffix[MAXPGPATH];
21152116

21162117
forkNameptr = strstr(filename, "_");
21172118
if (forkNameptr != NULL)

0 commit comments

Comments
 (0)