From: Anatol Belski Date: Mon, 29 Feb 2016 14:48:51 +0000 (+0100) Subject: Merge branch 'PHP-5.6' into PHP-7.0 X-Git-Tag: php-7.0.5RC1~52 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f806fedd806620ac7ebfd86e0906dcf04f918330;p=php 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 --- f806fedd806620ac7ebfd86e0906dcf04f918330 diff --cc ext/pdo_dblib/dblib_driver.c index cfb386fa0d,70b4402982..dcbaf55a3f --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@@ -329,11 -283,9 +329,9 @@@ static int pdo_dblib_handle_factory(pdo #endif ,{"10.0",DBVERSION_100} ,{"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 } @@@ -342,17 -294,12 +340,18 @@@ ,{ "secure", NULL, 0 } /* DBSETLSECURE */ ,{ "version", NULL, 0 } /* DBSETLVERSION */ }; - + 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) { + int timeout = pdo_attr_lval(driver_options, PDO_ATTR_TIMEOUT, 30); + dbsetlogintime(timeout); /* Connection/Login Timeout */ + dbsettime(timeout); /* Statement Timeout */ + } + H = pecalloc(1, sizeof(*H), dbh->is_persistent); H->login = dblogin(); H->err.sqlstate = dbh->error_code; diff --cc ext/pdo_dblib/dblib_stmt.c index 484bfbb560,2830272b82..43802264b6 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@@ -102,6 -102,17 +102,17 @@@ static int pdo_dblib_stmt_cursor_closer /* Cancel any pending results */ 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); ++ zend_string_release(stmt->columns[i].name); + } + } + efree(stmt->columns); + stmt->columns = NULL; + } return 1; } @@@ -110,8 -121,19 +121,19 @@@ static int pdo_dblib_stmt_dtor(pdo_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) { - efree(stmt->columns[i].name); ++ zend_string_release(stmt->columns[i].name); + } + } + efree(stmt->columns); + stmt->columns = NULL; + } + efree(S); - + return 1; }