com php-src: Fixed bug #64511 - pdo_dblib segfaults or leaks on nextRowset(): ext/pdo_dblib/dblib_stmt .c
| From: | Stanley Sufficool | Date: | Thu, 23 Oct 2014 03:13:22 +0000 |
| Subject: | com php-src: Fixed bug #64511 - pdo_dblib segfaults or leaks on nextRowset(): ext/pdo_dblib/dblib_stmt .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82466@lists.php.net to get a copy of this message | ||
Commit: 83144a72817775f793407d23f2701e9cdabb36cc
Author: Stanley Sufficool <ssufficool@php.net> Wed, 22 Oct 2014 20:13:22 -0700
Parents: fe8577efb1ecf845b937e877634f10ad95b08b75
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=83144a72817775f793407d23f2701e9cdabb36cc
Log:
Fixed bug #64511 - pdo_dblib segfaults or leaks on nextRowset()
Bugs:
https://bugs.php.net/64511
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 5909f64..bd79be3 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -103,21 +103,15 @@ static int pdo_dblib_stmt_cursor_closer(pdo_stmt_t *stmt TSRMLS_DC)
/* Cancel any pending results */
dbcancel(H->link);
- efree(stmt->columns);
- stmt->columns = NULL;
-
return 1;
}
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;
-
+
efree(S);
-
+
return 1;
}
@@ -128,16 +122,16 @@ static int pdo_dblib_stmt_next_rowset(pdo_stmt_t *stmt TSRMLS_DC)
RETCODE ret;
ret = dbresults(H->link);
-
+
if (FAIL == ret) {
pdo_raise_impl_error(stmt->dbh, stmt, "HY000", "PDO_DBLIB: dbresults() returned
FAIL" TSRMLS_CC);
return 0;
}
-
+
if(NO_MORE_RESULTS == ret) {
return 0;
}
-
+
stmt->row_count = DBCOUNT(H->link);
stmt->column_count = dbnumcols(H->link);
@@ -204,7 +198,7 @@ static int pdo_dblib_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC)
struct pdo_column_data *col = &stmt->columns[colno];
- col->name = (char*)dbcolname(H->link, colno+1);
+ col->name = estrdup(dbcolname(H->link, colno+1));
col->maxlen = dbcollen(H->link, colno+1);
col->namelen = strlen(col->name);
col->param_type = PDO_PARAM_STR;