From bdae05f5d106e215ca84857478716b6ae1cbf967 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 8 Oct 2003 03:52:32 +0000 Subject: Use calloc() to allocate empty structures. Fix pg_restore tar log output bug where Special flag wasn't being initialized; bug seen on XP. --- src/bin/pg_dump/pg_backup_tar.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/bin/pg_dump/pg_backup_tar.c') diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c index 88e1595787..8cf9b15e1b 100644 --- a/src/bin/pg_dump/pg_backup_tar.c +++ b/src/bin/pg_dump/pg_backup_tar.c @@ -16,7 +16,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.37 2003/08/04 00:43:27 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.38 2003/10/08 03:52:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -158,10 +158,11 @@ InitArchiveFmt_Tar(ArchiveHandle *AH) /* * Set up some special context used in compressing data. */ - ctx = (lclContext *) malloc(sizeof(lclContext)); + ctx = (lclContext *) calloc(1, sizeof(lclContext)); AH->formatData = (void *) ctx; ctx->filePos = 0; - + ctx->isSpecialScript = 0; + /* Initialize LO buffering */ AH->lo_buf_size = LOBBUFSIZE; AH->lo_buf = (void *) malloc(LOBBUFSIZE); @@ -253,7 +254,7 @@ _ArchiveEntry(ArchiveHandle *AH, TocEntry *te) lclTocEntry *ctx; char fn[K_STD_BUF_SIZE]; - ctx = (lclTocEntry *) malloc(sizeof(lclTocEntry)); + ctx = (lclTocEntry *) calloc(1, sizeof(lclTocEntry)); if (te->dataDumper != NULL) { #ifdef HAVE_LIBZ @@ -292,7 +293,7 @@ _ReadExtraToc(ArchiveHandle *AH, TocEntry *te) if (ctx == NULL) { - ctx = (lclTocEntry *) malloc(sizeof(lclTocEntry)); + ctx = (lclTocEntry *) calloc(1, sizeof(lclTocEntry)); te->formatData = (void *) ctx; } -- cgit v1.2.1