Re: Patch for PGunescapeBytea

From: "Magnus Naeslund(f)" <mag(at)fbab(dot)net>
To: "Ben Lamb" <pgsql-patches(at)zurgy(dot)org>, <pgsql-patches(at)postgresql(dot)org>
Cc: "Billy G(dot) Allie" <bill(dot)allie(at)mug(dot)org>
Subject: Re: Patch for PGunescapeBytea
Date: 2003-05-05 16:45:59
Message-ID: 00e001c31325$cf4b92a0$f80c0a0a@mnd
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Ben Lamb <pgsql-patches(at)zurgy(dot)org> wrote:
>> Hi,
>>
>> I found the libpq function PGunescapeBytea a little slow. It was
>> taking a minute and a half to decode a 500Kb on a fairly fast
>> machine. I think the culprit is sscanf.
[snip]

I think these lines:

buffer = realloc(buffer, buflen);
---
if (buffer == NULL)
return NULL;
---

are wrong. Shouldn't one do:
---
tmpbuf=realloc(buf,...);
if (!tmpbuf)
free(buf), return 0;
---

to avoid a memory leak?

... just checking ;)

Magnus

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Ben Lamb 2003-05-05 17:59:43 Re: Patch for PGunescapeBytea
Previous Message Bruce Momjian 2003-05-05 16:25:23 Re: Disable alternate locations on Win32