Re: Patch for PGunescapeBytea

Поиск
Список
Период
Сортировка
Искать
От
Magnus Naeslund(f)
Тема
Re: Patch for PGunescapeBytea
Дата
в 12:46:19
Msg-id
00e001c31325$cf4b92a0$f80c0a0a@mnd
Список
Дерево обсуждения
Patch for PGunescapeBytea Ben Lamb <pgsql-patches@zurgy.org>
Re: Patch for PGunescapeBytea Bruce Momjian <pgman@candle.pha.pa.us>
Ben Lamb  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
Дата:
От: Ben Lamb
Дата:
Сообщение: Re: Patch for PGunescapeBytea
FAQ