From 7d4bf3ccd9c68bb9be97a43487263e891d462b58 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Mon, 14 Feb 2005 13:31:34 +0000 Subject: [PATCH] free errmsg & prevent leaks --- ext/pdo_oci/oci_driver.c | 12 +++++++++++- ext/pdo_oci/oci_statement.c | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index 6c8cb80673..e6608c341a 100755 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -63,6 +63,11 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor einfo = &H->einfo; + if (einfo->errmsg) { + pefree(einfo->errmsg, dbh->is_persistent); + einfo->errmsg = NULL; + } + if (stmt) { S = (pdo_oci_stmt*)stmt->driver_data; einfo = &S->einfo; @@ -184,7 +189,12 @@ static int oci_handle_closer(pdo_dbh_t *dbh TSRMLS_DC) /* {{{ */ OCIHandleFree(H->env, OCI_HTYPE_ENV); H->env = NULL; } - + + if (H->einfo.errmsg) { + pefree(H->einfo.errmsg, dbh->is_persistent); + H->einfo.errmsg = NULL; + } + pefree(H, dbh->is_persistent); return 0; diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index 446785bfac..1d5bbe7980 100755 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -81,6 +81,11 @@ static int oci_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) stmt->bound_params = NULL; } + if (S->einfo.errmsg) { + efree(S->einfo.errmsg); + S->einfo.errmsg = NULL; + } + if (S->cols) { for (i = 0; i < stmt->column_count; i++) { if (S->cols[i].data) { -- 2.50.1