com php-src: Fix memory leak exhibited by bug_aaa.phpt: ext/pdo_firebird/firebird_statement.c
| From: | Christoph Michael Becker | Date: | Sat, 04 May 2019 12:20:11 +0000 |
| Subject: | com php-src: Fix memory leak exhibited by bug_aaa.phpt: ext/pdo_firebird/firebird_statement.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106029@lists.php.net to get a copy of this message | ||
Commit: ae21dc46da5126fb37b2b487760c558f3e8263f8
Author: Christoph M. Becker <cmbecker69@gmx.de> Sat, 4 May 2019 09:42:07 +0200
Parents: ba0913a2e56c2d5f43b0f06373a79e33702e0f58
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ae21dc46da5126fb37b2b487760c558f3e8263f8
Log:
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.
Changed paths:
M ext/pdo_firebird/firebird_statement.c
Diff:
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index 2dec82b..af71007 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)];
}