Re: [HACKERS] too many pfree in large object
От | Bruce Momjian |
---|---|
Тема | Re: [HACKERS] too many pfree in large object |
Дата | |
Msg-id | 199810060358.XAA27363@candle.pha.pa.us обсуждение исходный текст |
Ответ на | too many pfree in large object (t-ishii@sra.co.jp (Tatsuo Ishii)) |
Список | 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 ---------------------- > 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); > } Thanks. Fixed. I changed the line to read: ItemPointerCopy(&tuple->t_ctid, &obj_desc->htid); This way, I am getting it from the heap, not from the index tuple, and removed the duplicate pfree(). -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
В списке pgsql-hackers по дате отправления: