Found by Rainer Weikusat.
--HG--
branch : HEAD
static void consume_results(struct pgsql_db *db)
{
- do {
- if (!PQconsumeInput(db->pg))
- break;
+ PGresult *pgres;
+ while (PQconsumeInput(db->pg)) {
if (PQisBusy(db->pg))
return;
- } while (PQgetResult(db->pg) != NULL);
+
+ pgres = PQgetResult(db->pg);
+ if (pgres == NULL)
+ break;
+ PQclear(pgres);
+ }
if (PQstatus(db->pg) == CONNECTION_BAD)
io_remove_closed(&db->io);
if (result->pgres != NULL) {
PQclear(result->pgres);
+ result->pgres = NULL;
/* we'll have to read the rest of the results as well */
i_assert(db->io == NULL);