Re: beta6 pg_restore core dumps

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tatsuo Ishii <t-ishii@sra.co.jp>
Cc: pgsql-hackers@postgresql.org
Date: 2001-03-17T16:37:17Z
Lists: pgsql-hackers
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
> pg_restore crushes if dump data includes large objects...

This is probably the same problem that Martin Renters reported
yesterday.  I have a patch that seems to fix it on my machine,
but I haven't heard back from Martin whether it solves his case
completely.  In particular, he said something about memory leaks...

			regards, tom lane


*** pg_backup_custom.c.orig	Fri Feb  9 17:32:26 2001
--- pg_backup_custom.c	Fri Mar 16 17:24:59 2001
***************
*** 521,531 ****
  		if (blkLen > (ctx->inSize - 1)) {
  			free(ctx->zlibIn);
  			ctx->zlibIn = NULL;
! 			ctx->zlibIn = (char*)malloc(blkLen);
  			if (!ctx->zlibIn)
  				die_horribly(AH, "%s: failed to allocate decompression buffer\n", progname);
  
! 			ctx->inSize = blkLen;
  			in = ctx->zlibIn;
  		}
  
--- 521,531 ----
  		if (blkLen > (ctx->inSize - 1)) {
  			free(ctx->zlibIn);
  			ctx->zlibIn = NULL;
! 			ctx->zlibIn = (char*)malloc(blkLen+1);
  			if (!ctx->zlibIn)
  				die_horribly(AH, "%s: failed to allocate decompression buffer\n", progname);
  
! 			ctx->inSize = blkLen+1;
  			in = ctx->zlibIn;
  		}