Merge branch 'PHP-7.2'

* PHP-7.2:
  Fixed bug #75402 Possible Memory Leak using PDO::CURSOR_SCROLL option
This commit is contained in:
Anatol Belski 2018-07-30 18:29:40 +02:00
commit 093cb1d7c6
2 changed files with 119 additions and 0 deletions

View file

@ -163,6 +163,7 @@ static int pgsql_stmt_execute(pdo_stmt_t *stmt)
pdo_pgsql_error_stmt(stmt, status, pdo_pgsql_sqlstate(S->result));
return 0;
}
PQclear(S->result);
/* the cursor was declared correctly */
S->is_prepared = 1;
@ -432,6 +433,11 @@ static int pgsql_stmt_fetch(pdo_stmt_t *stmt,
return 0;
}
if(S->result) {
PQclear(S->result);
S->result = NULL;
}
spprintf(&q, 0, "FETCH %s FROM %s", ori_str, S->cursor_name);
efree(ori_str);
S->result = PQexec(S->H->server, q);