too many pfree in large object

From: t-ishii(at)sra(dot)co(dot)jp (Tatsuo Ishii)
To: hackers(at)postgreSQL(dot)org
Cc: t-ishii(at)sra(dot)co(dot)jp
Subject: too many pfree in large object
Date: 1998-10-03 14:30:45
Message-ID: 199810031432.XAA22238@meshsv26.tk.mesh.ad.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)sra(dot)co(dot)jp

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-10-03 14:54:15 Re: [COMMITTERS] 'pgsql/doc README.ipaddr'
Previous Message Bruce Momjian 1998-10-03 06:05:22 Open 6.4 items