diff options
author | Adam Baratz <adambaratz@php.net> | 2016-09-13 16:43:30 -0400 |
---|---|---|
committer | Adam Baratz <adambaratz@php.net> | 2016-09-13 16:43:30 -0400 |
commit | 69eef8c361c930d406254db16d0479fa74075e92 (patch) | |
tree | ec0dbc5dead1509496f1582c3561b72bd2496d91 /ext | |
parent | efadcb0390c3ef1ad0b3c445f886dc697bae44a7 (diff) | |
download | php-git-69eef8c361c930d406254db16d0479fa74075e92.tar.gz |
Free error and message strings when cleaning up PDO instances that use pdo_dblib
Diffstat (limited to 'ext')
-rw-r--r-- | ext/pdo_dblib/dblib_driver.c | 1 | ||||
-rw-r--r-- | ext/pdo_dblib/dblib_stmt.c | 16 | ||||
-rw-r--r-- | ext/pdo_dblib/pdo_dblib.c | 20 | ||||
-rw-r--r-- | ext/pdo_dblib/php_pdo_dblib_int.h | 2 |
4 files changed, 23 insertions, 16 deletions
diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index 13ddd8a472..66e7d79fbd 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -88,6 +88,7 @@ static int dblib_handle_closer(pdo_dbh_t *dbh) } pefree(H, dbh->is_persistent); dbh->driver_data = NULL; + pdo_dblib_err_dtor(&H->err); } return 0; } diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index 311d856d55..1c0577e611 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -95,22 +95,6 @@ static char *pdo_dblib_get_field_name(int type) } /* }}} */ -static void pdo_dblib_err_dtor(pdo_dblib_err *err) -{ - if (err->dberrstr) { - efree(err->dberrstr); - err->dberrstr = NULL; - } - if (err->lastmsg) { - efree(err->lastmsg); - err->lastmsg = NULL; - } - if (err->oserrstr) { - efree(err->oserrstr); - err->oserrstr = NULL; - } -} - static int pdo_dblib_stmt_cursor_closer(pdo_stmt_t *stmt) { pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data; diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c index b855224c68..9d119331ce 100644 --- a/ext/pdo_dblib/pdo_dblib.c +++ b/ext/pdo_dblib/pdo_dblib.c @@ -152,6 +152,26 @@ int pdo_dblib_msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate, return 0; } +void pdo_dblib_err_dtor(pdo_dblib_err *err) +{ + if (!err) { + return; + } + + if (err->dberrstr) { + efree(err->dberrstr); + err->dberrstr = NULL; + } + if (err->lastmsg) { + efree(err->lastmsg); + err->lastmsg = NULL; + } + if (err->oserrstr) { + efree(err->oserrstr); + err->oserrstr = NULL; + } +} + static PHP_GINIT_FUNCTION(dblib) { memset(dblib_globals, 0, sizeof(*dblib_globals)); diff --git a/ext/pdo_dblib/php_pdo_dblib_int.h b/ext/pdo_dblib/php_pdo_dblib_int.h index 87a0038ef4..01c538eed7 100644 --- a/ext/pdo_dblib/php_pdo_dblib_int.h +++ b/ext/pdo_dblib/php_pdo_dblib_int.h @@ -108,6 +108,8 @@ typedef struct { char *lastmsg; } pdo_dblib_err; +void pdo_dblib_err_dtor(pdo_dblib_err *err); + typedef struct { LOGINREC *login; DBPROCESS *link; |