mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
fix leaks and add one more NULL check
This commit is contained in:
parent
a310c3b484
commit
d7fd614cc6
@ -104,10 +104,16 @@ static int pdo_dblib_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
|
|||||||
dbcancel(H->link);
|
dbcancel(H->link);
|
||||||
|
|
||||||
if (stmt->columns) {
|
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);
|
efree(stmt->columns);
|
||||||
stmt->columns = NULL;
|
stmt->columns = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
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;
|
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
|
||||||
|
|
||||||
efree(stmt->columns);
|
if (stmt->columns) {
|
||||||
stmt->columns = NULL;
|
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);
|
efree(S);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user