Re: Patch for PGunescapeBytea

Поиск
Список
Период
Сортировка
От Magnus Naeslund(f)
Тема Re: Patch for PGunescapeBytea
Дата
Msg-id 00e001c31325$cf4b92a0$f80c0a0a@mnd
обсуждение исходный текст
Ответ на Patch for PGunescapeBytea  (Ben Lamb <pgsql-patches@zurgy.org>)
Ответы Re: Patch for PGunescapeBytea  (Ben Lamb <pgsql-patches@zurgy.org>)
Re: Patch for PGunescapeBytea  (Ben Lamb <pgsql-patches@zurgy.org>)
Список pgsql-patches
Ben Lamb <pgsql-patches@zurgy.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


В списке pgsql-patches по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Disable alternate locations on Win32
Следующее
От: Ben Lamb
Дата:
Сообщение: Re: Patch for PGunescapeBytea