Hi, ALL,
I have a following piece of code:

[code]
PGresult *res = PQexecPrepared();
status = PQresultStatue( res );
if( status == PGRES_TUPLES_OK )
{
    for( int j = 0; j < PQntuples( res ); j++ )
    {
        char *foo = PQgetValue( res, j, 0 );
        char *bar = PQgetValue( res, j, 1 );
        MyObject *obj = new MyObject( foo, bar );
        if( SetAdditionalProperties( obj ) )
        {
              result = 1;
              break;
        }
    }
    PQclear( res );
}

int SetAdditionalProperties(MyObject &obj)
{
// a call to PQexecParams() here
}
[/code]

If the call to SetAdditionalProperties() fails, I get a crash on
PQclear(), stating that
the pointer is not allocated.

Am I missing something? How do I fix the crash?

Thank you.


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to