too many pfree in large object

Поиск
Список
Период
Сортировка
От t-ishii@sra.co.jp (Tatsuo Ishii)
Тема too many pfree in large object
Дата
Msg-id 199810031432.XAA22238@meshsv26.tk.mesh.ad.jp
обсуждение исходный текст
Ответы Re: [HACKERS] too many pfree in large object
Список pgsql-hackers
Hi, there's a small bug in inv_fetchup().
In the following do-while loop, res is freed at the very
end of the loop. However, after getting out of the loop,
it gets freed again. Not good. Possible fix would be
changing the pfree(res) in the loop to:

  if (tuple == (HeapTuple)NULL) pfree(res);

------------------- inv_api.c ----------------------
        do
        {
            res = index_getnext(obj_desc->iscan, ForwardScanDirection);

            if (res == (RetrieveIndexResult) NULL)
            {
                ItemPointerSetInvalid(&(obj_desc->htid));
                return (HeapTuple) NULL;
            }

            /*
             * For time travel, we need to use the actual time qual here,
             * rather that NowTimeQual.  We currently have no way to pass
             * a time qual in.
             *
             * This is now valid for snapshot !!! And should be fixed in some
             * way...    - vadim 07/28/98
             *
             */

            tuple = heap_fetch(obj_desc->heap_r, SnapshotNow,
                               &res->heap_iptr, buffer);
            pfree(res);
        } while (tuple == (HeapTuple) NULL);

        /* remember this tid -- we may need it for later reads/writes */
        ItemPointerCopy(&(res->heap_iptr), &(obj_desc->htid));
        pfree(res);
    }
------------------- inv_api.c -----------------
--
Tatsuo Ishii
t-ishii@sra.co.jp


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Open 6.4 items
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [COMMITTERS] 'pgsql/doc README.ipaddr'