Re: pg_upgrade segfault (was: pg_migrator segfault)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: hernan gonzalez <hgonzalez(at)gmail(dot)com>
Cc: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: pg_upgrade segfault (was: pg_migrator segfault)
Date: 2010-11-02 19:23:37
Message-ID: 3659.1288725817@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hernan gonzalez <hgonzalez(at)gmail(dot)com> writes:
> In pg_upgrade/controldata.c , putenv2 function :
> char *envstr = (char *) pg_malloc(ctx, strlen(var)
> + strlen(val) + 1);
> sprintf(envstr, "%s=%s", var, val);

> Shouldn't it be "+ 2 " instead of "+ 1" ?

Yup, it sure should. So probably the reason you're the first one to see
it is that the problem would depend on the exact lengths of the strings
being used here :-(

> But it's not enough to get valgrind happy (It still reports 4 "definitely
> lost" blocks, all from that putenv2 function).

That's expected; those blocks aren't supposed to get freed.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Tripathy 2010-11-02 20:43:48 Return key from query
Previous Message hernan gonzalez 2010-11-02 19:07:44 Re: pg_upgrade segfault (was: pg_migrator segfault)