Re: not checking value returned from palloc?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Mark Dilger <pgsql(at)markdilger(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: not checking value returned from palloc?
Date: 2006-03-19 22:14:33
Message-ID: 200603192214.k2JMEXZ14227@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Mark Dilger wrote:
> > Peter Eisentraut wrote:
> > >Mark Dilger wrote:
> > >
> > >>Looking through the postgresql source code, I notice that there are
> > >>many places were palloc is used but the return value is not checked
> > >>to see if it is null.
> > >
> > >palloc will throw an exception if it cannot fulfill the request. Code
> > >that checks the return value for null is in fact a waste.
> >
> > Interesting. So the patch should go the other way, and remove the checks
> > that are currently in the code?
>
> Yes, if you find any such place please submit a patch.

I see one in cash.c that I will remove.

--
Bruce Momjian http://candle.pha.pa.us
SRA OSS, Inc. http://www.sraoss.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Browne 2006-03-19 22:24:21 Re: [HACKERS] PostgreSQL Anniversary Proposals -- Important Update
Previous Message Alvaro Herrera 2006-03-19 22:10:22 Re: not checking value returned from palloc?