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