summaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_backup_files.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_dump/pg_backup_files.c')
-rw-r--r--src/bin/pg_dump/pg_backup_files.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/bin/pg_dump/pg_backup_files.c b/src/bin/pg_dump/pg_backup_files.c
index afd53bff8e2..76366e190bc 100644
--- a/src/bin/pg_dump/pg_backup_files.c
+++ b/src/bin/pg_dump/pg_backup_files.c
@@ -26,6 +26,7 @@
*/
#include "pg_backup_archiver.h"
+#include "common.h"
static void _ArchiveEntry(ArchiveHandle *AH, TocEntry *te);
static void _StartData(ArchiveHandle *AH, TocEntry *te);
@@ -103,15 +104,13 @@ InitArchiveFmt_Files(ArchiveHandle *AH)
/*
* Set up some special context used in compressing data.
*/
- ctx = (lclContext *) calloc(1, sizeof(lclContext));
+ ctx = (lclContext *) pg_calloc(1, sizeof(lclContext));
AH->formatData = (void *) ctx;
ctx->filePos = 0;
/* Initialize LO buffering */
AH->lo_buf_size = LOBBUFSIZE;
- AH->lo_buf = (void *) malloc(LOBBUFSIZE);
- if (AH->lo_buf == NULL)
- die_horribly(AH, modulename, "out of memory\n");
+ AH->lo_buf = (void *) pg_malloc(LOBBUFSIZE);
/*
* Now open the TOC file
@@ -183,7 +182,7 @@ _ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
lclTocEntry *ctx;
char fn[K_STD_BUF_SIZE];
- ctx = (lclTocEntry *) calloc(1, sizeof(lclTocEntry));
+ ctx = (lclTocEntry *) pg_calloc(1, sizeof(lclTocEntry));
if (te->dataDumper)
{
#ifdef HAVE_LIBZ
@@ -194,7 +193,7 @@ _ArchiveEntry(ArchiveHandle *AH, TocEntry *te)
#else
sprintf(fn, "%d.dat", te->dumpId);
#endif
- ctx->filename = strdup(fn);
+ ctx->filename = pg_strdup(fn);
}
else
{
@@ -222,7 +221,7 @@ _ReadExtraToc(ArchiveHandle *AH, TocEntry *te)
if (ctx == NULL)
{
- ctx = (lclTocEntry *) calloc(1, sizeof(lclTocEntry));
+ ctx = (lclTocEntry *) pg_calloc(1, sizeof(lclTocEntry));
te->formatData = (void *) ctx;
}