summaryrefslogtreecommitdiff
path: root/ext/pdo_firebird
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-05-04 09:42:07 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-05-04 14:20:11 +0200
commitae21dc46da5126fb37b2b487760c558f3e8263f8 (patch)
tree67f5df030e0d0056af8e0b013ea820346b6add24 /ext/pdo_firebird
parentba0913a2e56c2d5f43b0f06373a79e33702e0f58 (diff)
downloadphp-git-ae21dc46da5126fb37b2b487760c558f3e8263f8.tar.gz
Fix memory leak exhibited by bug_aaa.phpt
Since a statement may be executed multiple times, we need to free already allocated storage for output data before allocating new storage.
Diffstat (limited to 'ext/pdo_firebird')
-rw-r--r--ext/pdo_firebird/firebird_statement.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index 2dec82b0ba..af71007b56 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -104,6 +104,9 @@ static int firebird_stmt_execute(pdo_stmt_t *stmt) /* {{{ */
unsigned int i;
for (i = 0; i < S->out_sqlda.sqld; i++) {
XSQLVAR *var = &S->out_sqlda.sqlvar[i];
+ if (var->sqlind) {
+ efree(var->sqlind);
+ }
var->sqlind = (void*)ecalloc(1, var->sqllen + 2 * sizeof(short));
var->sqldata = &((char*)var->sqlind)[sizeof(short)];
}