RE: single a suggestion - Mailing list pgsql-bugs

From Piers Scannell
Subject RE: single a suggestion
Date
Msg-id F0DBB65C297FD211B06300A0C9DAFEE33CC8CE@bert.internal.zone
Whole thread Raw
In response to single a suggestion  (pgsql-bugs@postgresql.org)
List pgsql-bugs
If the developers don't have strict control over what they are doing - then
I'm confused! Who does have control? Are they using some kind of ghostly
automatic programming whilst in a trance? :-)

Segfaults like that (or failed assertions, etc) are like a big red flag
telling you there's a logic error in your program!

Take things like that away and who knows what little errors slip through
testing and QA ready to bite you after release.


Piers Scannell
Systems Engineer, GlobeCast France Telecom
Tel: +44 1707 667 228   Fax: +44 1707 667 206



> -----Original Message-----
> From: pgsql-bugs@postgresql.org [mailto:pgsql-bugs@postgresql.org]
> Sent: 06 February 2001 06:12
> To: pgsql-bugs@postgresql.org
> Subject: [BUGS] single a suggestion
>
>
> KADIR ROJAS (ridak22@tutopia.com) reports a bug with a severity of 3
> The lower the number the more severe it is.
>
> Short Description
> single a suggestion
>
> Long Description
> Hello from Panama.
>
> Working with pglib library, I discovered
> something, that could become a problem for the developers if
> they don't
> have strict control over what they are doing.  It is the PQclear()
> function.
>
> When we call this function to release the assigned
> resources, and it has been called previously, it is not registered,
> causing a segmentation fault in the programs. I think that we
> could avoid some headaches to our programs, if we give a more
> robust form to the function,
> making a safer PQclear function.
>
> At the time of declaring the pointer to the structure it
> must be initialized in NULL (PQresult * res=NULL).
> This could guarantee that it won't accidentally release
> nonassigned resources. If we make this change the library itself
> would be able to have a registry of the calls to the function pqclear,
> so, the programmers wouldn't have to worry about this little issue and
> concentrate on other subjects. I'd like to know what do you
> think of this.
>
> thanks a lot for your attention.
> KJRC
>
>
> Sample Code
> /* Secure PQclear */
> void SPQclear(PQresult **res)
> {
>  if(*res)
>   {
>    PQclear(*res);
>    *res = NULL;
>   }
>  return;
> }
>
> void main(void)
> {
>  PQresult *res=NULL;
>
>   .
>   .
>   .
>   SPQclear(&res);
>   .
>   .
>   .
> }
>
> No file was uploaded with this report
>

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: single a suggestion
Next
From: Peter T Mount
Date:
Subject: Re: Bug and Bugfix for the jdbc-driver