From: | Piers Scannell <piers(dot)scannell(at)globecastne(dot)com> |
---|---|
To: | "'pgsql-bugs(at)postgresql(dot)org'" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | RE: single a suggestion |
Date: | 2001-02-06 09:23:57 |
Message-ID: | F0DBB65C297FD211B06300A0C9DAFEE33CC8CE@bert.internal.zone |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)org [mailto:pgsql-bugs(at)postgresql(dot)org]
> Sent: 06 February 2001 06:12
> To: pgsql-bugs(at)postgresql(dot)org
> Subject: [BUGS] single a suggestion
>
>
> KADIR ROJAS (ridak22(at)tutopia(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter T Mount | 2001-02-06 09:28:19 | Re: Bug and Bugfix for the jdbc-driver |
Previous Message | pgsql-bugs | 2001-02-06 06:11:31 | single a suggestion |