com php-src: fix leaks and add one more NULL check: ext/pdo_dblib/dblib_stmt.c
| From: | Anatol Belski | Date: | Mon, 29 Feb 2016 14:38:42 +0000 |
| Subject: | com php-src: fix leaks and add one more NULL check: ext/pdo_dblib/dblib_stmt.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-91186@lists.php.net to get a copy of this message | ||
Commit: d7fd614cc6149884bc29818d9467bc5bc269e81c
Author: Anatol Belski <ab@php.net> Mon, 29 Feb 2016 15:38:42 +0100
Parents: a310c3b484051424c4545a00b731b78a4fff7982
Branches: PHP-5.6 PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d7fd614cc6149884bc29818d9467bc5bc269e81c
Log:
fix leaks and add one more NULL check
Changed paths:
M ext/pdo_dblib/dblib_stmt.c
Diff:
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index 3876482..2830272 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -104,10 +104,16 @@ static int pdo_dblib_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
dbcancel(H->link);
if (stmt->columns) {
+ int i = 0;
+ for (; i < stmt->column_count; i++) {
+ if (stmt->columns[i].name) {
+ efree(stmt->columns[i].name);
+ }
+ }
efree(stmt->columns);
stmt->columns = NULL;
}
-
+
return 1;
}
@@ -115,8 +121,16 @@ static int pdo_dblib_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC)
{
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
- efree(stmt->columns);
- stmt->columns = NULL;
+ if (stmt->columns) {
+ int i = 0;
+ for (; i < stmt->column_count; i++) {
+ if (stmt->columns[i].name) {
+ efree(stmt->columns[i].name);
+ }
+ }
+ efree(stmt->columns);
+ stmt->columns = NULL;
+ }
efree(S);