Re: [PATCHES] [HACKERS] Patch for psql.c - Mailing list pgsql-hackers

From James A. Hillyerd
Subject Re: [PATCHES] [HACKERS] Patch for psql.c
Date
Msg-id 40cce8eaf88318a039cc690f3fd03c0b
Whole thread Raw
List pgsql-hackers
On Mon, 2 Jun 1997, Igor wrote:

> Well...I put these PQclear's in because there were memory leaks in that
> area. If you put it outside, of the case statement, you start clearing
> already freed tuples causing a mess (Marc.. that was the reason why
> regression screwed up on boolean). Now, there are a few more memory leaks
> (particularly with PGsettings *settings variable) but it doesn't leak much
> and will be left alone until 6.2 probably.
> I guess if you do if(results) PQclear (results)...oh well...There are no
> memory leaks from PQexec anymore so might just as well leave it alone for
> now.
>

I don't know if everything knows this or not, but free()ing a null pointer
is valid, so it may be easier to set pointers to null after freeing them,
then there wouldn't be much penalty in free()ing them again.

I guess that is sloppy coding though. =)

- -james

[  James A. Hillyerd (JH2162) james@blarg.net - Perl Programmer  ]
[   http://www.blarg.net/~james/     http://www.pimedia.com/     ]
[ 1024/B11C3751 CA 1C B3 A9 07 2F 57 C9  91 F4 73 F2 19 A4 C5 88 ]

------------------------------

pgsql-hackers by date:

Previous
From: Igor
Date:
Subject: Re: [PATCHES] [HACKERS] Patch for psql.c
Next
From: Igor
Date:
Subject: Re: [PATCHES] [HACKERS] Patch for psql.c