Re: Patch for PGunescapeBytea - Mailing list pgsql-patches

From Ben Lamb
Subject Re: Patch for PGunescapeBytea
Date
Msg-id 200305081154.22776.pgsql-patches@zurgy.org
Whole thread Raw
In response to Re: Patch for PGunescapeBytea  ("Magnus Naeslund(f)" <mag@fbab.net>)
Responses Re: Patch for PGunescapeBytea
List pgsql-patches
Here is a new patch for src/interfaces/libpq/fe-exec.c that incorporates the
change suggested by Magnus. The patch significantly improves the speed of
PGunescapeBytea().

Ben.


> [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


Attachment

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Pass shared memory address to exec'ed backend
Next
From: Alvaro Herrera
Date:
Subject: Re: 2nd nested trasanctions supporting patch