Opened 13 years ago

Last modified 13 years ago

#1514 closed defect (fixed)

Query results not cleaned in Soft Transactions of PG

Reported by: Mateusz Łoskot Owned by: Mateusz Łoskot
Priority: high Milestone:
Component: OGR_SF Version: 1.4.0
Severity: major Keywords:

Description (last modified by Mateusz Łoskot)

In functions operating on Soft Transactions, query results are not properly released when error occur. Is it intentional?

For example, in OGRPGDataSource::SoftRollback?()

hResult = PQexec(hPGConn, "ROLLBACK");

if( !hResult || PQresultStatus(hResult) != PGRES_COMMAND_OK )

PQclear( hResult );

The PQclear() call is missing before return OGRERR_FAILURE.

Change History (4)

comment:1 Changed 13 years ago by warmerdam

this is unintentional.  Please correct. 

Take care of course to not try and release a NULL hResult.

comment:2 Changed 13 years ago by Mateusz Łoskot

The bug has been fixed.

Here is detailed changeset:

Along refactoring, new file has been added - ogrpgutility.h - with inline free
function OGRPGClearResult() which is a simple and safe wrapper on PQclear()

Everything builds locally and on Buildbot.
All autotests pass.
Manually executed tests using ogrinfo pass, without any complains from Valgrind.

comment:4 Changed 13 years ago by Mateusz Łoskot

Description: modified (diff)

comment:5 Changed 13 years ago by Mateusz Łoskot

I ported the fix to the stable branch 1.4. (r11225).

Note: See TracTickets for help on using tickets.