1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 06:51:18 +02:00

Merge branch 'PHP-5.6' into PHP-7.0

* PHP-5.6:
  fix leaks and add one more NULL check
  add NULL check
  fix C89 compat
  fix arg type
This commit is contained in:
Anatol Belski
2016-02-29 15:48:51 +01:00
2 changed files with 25 additions and 4 deletions

View File

@@ -331,9 +331,7 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
,{"auto",0} /* Only works with FreeTDS. Other drivers will bork */
};
nvers = sizeof(tdsver)/sizeof(tdsver[0]);
struct pdo_data_src_parser vars[] = {
{ "charset", NULL, 0 }
,{ "appname", "PHP " PDO_DBLIB_FLAVOUR, 0 }
@@ -344,7 +342,8 @@ static int pdo_dblib_handle_factory(pdo_dbh_t *dbh, zval *driver_options)
};
nvars = sizeof(vars)/sizeof(vars[0]);
nvers = sizeof(tdsver)/sizeof(tdsver[0]);
php_pdo_parse_data_source(dbh->data_source, dbh->data_source_len, vars, nvars);
if (driver_options) {

View File

@@ -102,6 +102,17 @@ static int pdo_dblib_stmt_cursor_closer(pdo_stmt_t *stmt)
/* Cancel any pending results */
dbcancel(H->link);
if (stmt->columns) {
int i = 0;
for (; i < stmt->column_count; i++) {
if (stmt->columns[i].name) {
zend_string_release(stmt->columns[i].name);
}
}
efree(stmt->columns);
stmt->columns = NULL;
}
return 1;
}
@@ -110,6 +121,17 @@ static int pdo_dblib_stmt_dtor(pdo_stmt_t *stmt)
{
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
if (stmt->columns) {
int i = 0;
for (; i < stmt->column_count; i++) {
if (stmt->columns[i].name) {
zend_string_release(stmt->columns[i].name);
}
}
efree(stmt->columns);
stmt->columns = NULL;
}
efree(S);
return 1;