Skip to content

Commit 9cce863

Browse files
committed
[Issue #168] use heap variable as buffer in write_backup_filelist() instead of stack variable
1 parent 6ad38c6 commit 9cce863

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/catalog.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
15671567
int errno_temp;
15681568
size_t i = 0;
15691569
#define BUFFERSZ 1024*1024
1570-
char buf[BUFFERSZ];
1570+
char *buf;
15711571
size_t write_len = 0;
15721572
int64 backup_size_on_disk = 0;
15731573
int64 uncompressed_size_on_disk = 0;
@@ -1581,6 +1581,8 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
15811581
elog(ERROR, "Cannot open file list \"%s\": %s", path_temp,
15821582
strerror(errno));
15831583

1584+
buf = pgut_malloc(BUFFERSZ);
1585+
15841586
/* print each file in the list */
15851587
while(i < parray_num(files))
15861588
{
@@ -1693,6 +1695,8 @@ write_backup_filelist(pgBackup *backup, parray *files, const char *root,
16931695
backup->data_bytes = backup_size_on_disk;
16941696
backup->wal_bytes = wal_size_on_disk;
16951697
backup->uncompressed_bytes = uncompressed_size_on_disk;
1698+
1699+
free(buf);
16961700
}
16971701

16981702
/*

0 commit comments

Comments
 (0)