summaryrefslogtreecommitdiff
path: root/ext/pdo_dblib/pdo_dblib.c
diff options
context:
space:
mode:
authorAdam Baratz <adambaratz@php.net>2016-09-13 16:43:30 -0400
committerAdam Baratz <adambaratz@php.net>2016-09-13 16:43:30 -0400
commit69eef8c361c930d406254db16d0479fa74075e92 (patch)
treeec0dbc5dead1509496f1582c3561b72bd2496d91 /ext/pdo_dblib/pdo_dblib.c
parentefadcb0390c3ef1ad0b3c445f886dc697bae44a7 (diff)
downloadphp-git-69eef8c361c930d406254db16d0479fa74075e92.tar.gz
Free error and message strings when cleaning up PDO instances that use pdo_dblib
Diffstat (limited to 'ext/pdo_dblib/pdo_dblib.c')
-rw-r--r--ext/pdo_dblib/pdo_dblib.c20
1 files changed, 20 insertions, 0 deletions
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));